fix(pt/pobreflix): Fix corner case in extractor (#2134)
This commit is contained in:
@ -11,28 +11,57 @@ import okhttp3.OkHttpClient
|
|||||||
|
|
||||||
class PainelfxExtractor(private val client: OkHttpClient) {
|
class PainelfxExtractor(private val client: OkHttpClient) {
|
||||||
fun videosFromUrl(url: String, headers: Headers): List<Video> {
|
fun videosFromUrl(url: String, headers: Headers): List<Video> {
|
||||||
val doc = client.newCall(GET(url)).execute().asJsoup()
|
val docHeaders = headers.newBuilder().set("Referer", "https://gastronomiabrasileira.net/").build()
|
||||||
|
val doc = client.newCall(GET(url, docHeaders)).execute().use { it.asJsoup() }
|
||||||
val lang = when (url.substringAfterLast("/")) {
|
val lang = when (url.substringAfterLast("/")) {
|
||||||
"leg" -> "Legendado"
|
"leg" -> "Legendado"
|
||||||
else -> "Dublado"
|
else -> "Dublado"
|
||||||
}
|
}
|
||||||
return doc.select("div.panel-body > button").flatMap { elem ->
|
|
||||||
val form = FormBody.Builder()
|
val host = url.toHttpUrl().host
|
||||||
.add("idS", elem.attr("idS"))
|
val videoHeaders = headers.newBuilder().set("Referer", "https://$host/").build()
|
||||||
.build()
|
|
||||||
val host = url.toHttpUrl().host
|
val buttons = doc.select("div.panel-body > button")
|
||||||
val newHeaders = headers.newBuilder().set("Referer", "https://$host/").build()
|
|
||||||
val req = client.newCall(POST("https://$host/CallEpi", body = form)).execute()
|
val encodedHexList = when {
|
||||||
val decoded = req.body.string().decodeHex().let(::String).replace("\\", "")
|
buttons.isNotEmpty() -> {
|
||||||
if (decoded.contains("video\"")) {
|
buttons.map { elem ->
|
||||||
decoded.substringAfter("video").split("{").drop(1).map {
|
val form = FormBody.Builder()
|
||||||
val videoUrl = it.substringAfter("file\":\"").substringBefore('"')
|
.add("idS", elem.attr("idS"))
|
||||||
val quality = it.substringAfter("label\":\"").substringBefore('"')
|
.build()
|
||||||
Video(videoUrl, "$lang - $quality", videoUrl, newHeaders)
|
client.newCall(POST("https://$host/CallEpi", body = form)).execute()
|
||||||
|
.use { it.body.string() }
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
emptyList()
|
|
||||||
}
|
}
|
||||||
|
else -> {
|
||||||
|
val script = doc.selectFirst("script:containsData(idS:)")?.data() ?: return emptyList()
|
||||||
|
val idList = script.split("idS:").drop(1).map { it.substringAfter('"').substringBefore('"') }
|
||||||
|
|
||||||
|
idList.map { idS ->
|
||||||
|
val form = FormBody.Builder()
|
||||||
|
.add("id", idS)
|
||||||
|
.build()
|
||||||
|
client.newCall(POST("https://$host/CallPlayer", body = form)).execute()
|
||||||
|
.use { it.body.string() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return encodedHexList.flatMap {
|
||||||
|
videosFromHex(it, lang, videoHeaders)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun videosFromHex(hex: String, lang: String, videoHeaders: Headers): List<Video> {
|
||||||
|
val decoded = hex.decodeHex().let(::String).replace("\\", "")
|
||||||
|
return if (decoded.contains("video\"")) {
|
||||||
|
decoded.substringAfter("video").split("{").drop(1).map {
|
||||||
|
val videoUrl = it.substringAfter("file\":\"").substringBefore('"')
|
||||||
|
val quality = it.substringAfter("label\":\"").substringBefore('"')
|
||||||
|
Video(videoUrl, "$lang - $quality", videoUrl, videoHeaders)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
emptyList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class DooPlayGenerator : ThemeSourceGenerator {
|
|||||||
SingleLang("Multimovies", "https://multimovies.shop", "en", isNsfw = false, overrideVersionCode = 9),
|
SingleLang("Multimovies", "https://multimovies.shop", "en", isNsfw = false, overrideVersionCode = 9),
|
||||||
SingleLang("pactedanime", "https://pactedanime.com", "en", isNsfw = false, className = "PactedAnime", overrideVersionCode = 4),
|
SingleLang("pactedanime", "https://pactedanime.com", "en", isNsfw = false, className = "PactedAnime", overrideVersionCode = 4),
|
||||||
SingleLang("Pi Fansubs", "https://pifansubs.org", "pt-BR", isNsfw = true, overrideVersionCode = 17),
|
SingleLang("Pi Fansubs", "https://pifansubs.org", "pt-BR", isNsfw = true, overrideVersionCode = 17),
|
||||||
SingleLang("Pobreflix", "https://pobreflix.biz", "pt-BR", isNsfw = true),
|
SingleLang("Pobreflix", "https://pobreflix.biz", "pt-BR", isNsfw = true, overrideVersionCode = 1),
|
||||||
SingleLang("UniqueStream", "https://uniquestream.net", "en", isNsfw = false, overrideVersionCode = 2),
|
SingleLang("UniqueStream", "https://uniquestream.net", "en", isNsfw = false, overrideVersionCode = 2),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user