This commit is contained in:
hexated 2022-08-26 05:12:40 +07:00
parent 9301aec0df
commit aea062bda8

View file

@ -1,10 +1,11 @@
package com.lagradost.cloudstream3.extractors package com.lagradost.cloudstream3.extractors
import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.APIHolder import com.lagradost.cloudstream3.APIHolder.getCaptchaToken
import com.lagradost.cloudstream3.ErrorLoadingException import com.lagradost.cloudstream3.ErrorLoadingException
import com.lagradost.cloudstream3.SubtitleFile
import com.lagradost.cloudstream3.app import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.utils.AppUtils import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
import com.lagradost.cloudstream3.utils.ExtractorApi import com.lagradost.cloudstream3.utils.ExtractorApi
import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.M3u8Helper import com.lagradost.cloudstream3.utils.M3u8Helper
@ -14,21 +15,24 @@ class Zorofile : ExtractorApi() {
override val mainUrl = "https://zorofile.com" override val mainUrl = "https://zorofile.com"
override val requiresReferer = true override val requiresReferer = true
override suspend fun getUrl(url: String, referer: String?): List<ExtractorLink> { override suspend fun getUrl(
url: String,
referer: String?,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
val id = url.split("?").first().split("/").last() val id = url.split("?").first().split("/").last()
val token = app.get( val token = app.get(
url, url,
referer = referer referer = referer
).document.select("button.g-recaptcha").attr("data-sitekey").let { captchaKey -> ).document.select("button.g-recaptcha").attr("data-sitekey").let { captchaKey ->
APIHolder.getCaptchaToken( getCaptchaToken(
url, url,
captchaKey, captchaKey,
referer = referer referer = referer
) )
} ?: throw ErrorLoadingException("can't bypass captcha") } ?: throw ErrorLoadingException("can't bypass captcha")
val sources = mutableListOf<ExtractorLink>()
val data = app.post( val data = app.post(
"$mainUrl/dl", "$mainUrl/dl",
data = mapOf( data = mapOf(
@ -41,10 +45,6 @@ class Zorofile : ExtractorApi() {
referer = url, referer = url,
headers = mapOf( headers = mapOf(
"Accept" to "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8", "Accept" to "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
// "Accept-Encoding" to "gzip, deflate, br",
// "Accept-Language" to "en-US,en;q=0.5",
// "Connection" to "keep-alive",
"Content-Length" to "626",
"Content-Type" to "application/x-www-form-urlencoded", "Content-Type" to "application/x-www-form-urlencoded",
"Origin" to mainUrl, "Origin" to mainUrl,
"Sec-Fetch-Dest" to "iframe", "Sec-Fetch-Dest" to "iframe",
@ -57,17 +57,16 @@ class Zorofile : ExtractorApi() {
?.substringAfter("sources: [")?.substringBefore("],")?.replace("src", "\"src\"") ?.substringAfter("sources: [")?.substringBefore("],")?.replace("src", "\"src\"")
?.replace("type", "\"type\"") ?.replace("type", "\"type\"")
AppUtils.tryParseJson<Sources>("$data")?.let { res -> tryParseJson<Sources>("$data")?.let { res ->
M3u8Helper.generateM3u8( return M3u8Helper.generateM3u8(
name, name,
res.src ?: return@let, res.src ?: return@let,
"$mainUrl/", "$mainUrl/",
headers = mapOf( headers = mapOf(
"Origin" to mainUrl, "Origin" to mainUrl,
) )
).forEach { m3uData -> sources.add(m3uData) } ).forEach(callback)
} }
return sources
} }
private data class Sources( private data class Sources(