Fixed okru extractor (#1301)

Co-authored-by: misajimenezmx <misajimenez.mx@gmail.com>
This commit is contained in:
redblacker8
2024-08-24 15:44:44 -06:00
committed by GitHub
parent 52fa1838c8
commit e6766f4c0c
4 changed files with 28 additions and 11 deletions

View File

@ -13,11 +13,17 @@ open class Odnoklassniki : ExtractorApi() {
override val requiresReferer = false
override suspend fun getUrl(url: String, referer: String?, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit) {
val extRef = referer ?: ""
val headers = mapOf(
"Accept" to "*/*",
"Connection" to "keep-alive",
"Sec-Fetch-Dest" to "empty",
"Sec-Fetch-Mode" to "cors",
"Sec-Fetch-Site" to "cross-site",
"Origin" to mainUrl,
"User-Agent" to USER_AGENT,
)
val userAgent = mapOf("User-Agent" to "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Mobile Safari/537.36")
val videoReq = app.get(url, headers=userAgent).text.replace("\\&quot;", "\"").replace("\\\\", "\\")
val videoReq = app.get(url, headers=headers).text.replace("\\&quot;", "\"").replace("\\\\", "\\")
.replace(Regex("\\\\u([0-9A-Fa-f]{4})")) { matchResult ->
Integer.parseInt(matchResult.groupValues[1], 16).toChar().toString()
}
@ -43,10 +49,10 @@ open class Odnoklassniki : ExtractorApi() {
source = this.name,
name = this.name,
url = videoUrl,
referer = url,
referer = "$mainUrl/",
quality = getQualityFromName(quality),
headers = userAgent,
isM3u8 = false
headers = headers,
isM3u8 = false,
)
)
}

View File

@ -1,6 +1,7 @@
package com.lagradost.cloudstream3.extractors
import com.lagradost.cloudstream3.SubtitleFile
import com.lagradost.cloudstream3.USER_AGENT
import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.utils.*
@ -16,18 +17,22 @@ open class StreamSilk : ExtractorApi() {
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
val response = app.get(url, headers = mapOf(
"Accept" to "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
),)
val response = app.get(url, headers = mapOf("Accept" to "*/*"))
response.document.select("script").firstOrNull {
it.html().contains("h,u,n,t,e,r")
}?.html()?.let { hunted ->
JsHunter(hunted).dehunt()?.let { script ->
srcRegex.find(script)?.groupValues?.get(1)?.trim()?.let { link ->
val headers = mapOf(
"Origin" to mainUrl,
"Referer" to "$mainUrl/",
"User-Agent" to USER_AGENT,
)
M3u8Helper.generateM3u8(
name,
link,
"$mainUrl/"
"$mainUrl/",
headers = headers
).forEach(callback)
}
}

View File

@ -22,6 +22,10 @@ class Vidguardto2 : Vidguardto() {
override val mainUrl = "https://listeamed.net"
}
class Vidguardto3 : Vidguardto() {
override val mainUrl = "https://vgfplay.com"
}
open class Vidguardto : ExtractorApi() {
override val name = "Vidguard"
override val mainUrl = "https://vidguard.to"

View File

@ -280,6 +280,7 @@ import com.lagradost.cloudstream3.extractors.VidHidePro6
import com.lagradost.cloudstream3.extractors.Lulustream1
import com.lagradost.cloudstream3.extractors.Lulustream2
import com.lagradost.cloudstream3.extractors.Lulustream3
import com.lagradost.cloudstream3.extractors.Vidguardto3
import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.mvvm.normalSafeApiCall
import kotlinx.coroutines.delay
@ -967,6 +968,7 @@ val extractorApis: MutableList<ExtractorApi> = arrayListOf(
Vidguardto(),
Vidguardto1(),
Vidguardto2(),
Vidguardto3(),
Simpulumlamerop(),
Urochsunloath(),
Yipsu(),