revert the link decryption in gogo

This commit is contained in:
Arjix 2021-10-25 00:24:37 +03:00 committed by GitHub
parent f673b41391
commit 8bd6880f6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -205,28 +205,6 @@ class GogoanimeProvider : MainAPI() {
)
}
private val garbages = listOf(
"URASDGHUSRFSJGYfdsffsderFStewthsfSFtrfte",
"AdeqwrwedffryretgsdFrsftrsvfsfsr",
"werFrefdsfrersfdsrfer36343534",
"AawehyfcghysfdsDGDYdgdsf",
"wstdgdsgtert",
"Adrefsd",
"sdf"
)
private fun decryptRedirect(uri: String): String {
val isGogoCdn = Regex("""download\.php\?url=([^?&/]+)""").find(uri)
if (isGogoCdn?.destructured == null) return uri
var encryptedUrl = isGogoCdn.destructured.component1()
garbages.forEach {
encryptedUrl = encryptedUrl.replace(it, "")
}
return base64Decode(encryptedUrl + "=".repeat(encryptedUrl.length % 4))
}
private fun extractVideos(uri: String): List<ExtractorLink> {
val html = get(uri).text
val doc = Jsoup.parse(html)
@ -234,38 +212,36 @@ class GogoanimeProvider : MainAPI() {
val iframe = "https:" + doc.selectFirst("div.play-video > iframe").attr("src")
val link = iframe.replace("streaming.php", "download")
val page = get(link, referer=iframe, cacheTime = 0)
val page = get(link, headers = mapOf("Referer" to iframe))
val pageDoc = Jsoup.parse(page.text)
val qualities = ArrayList<ExtractorLink>()
pageDoc.select(".dowload > a").pmap {
return pageDoc.select(".dowload > a").pmap {
if (it.hasAttr("download")) {
val qual = if (it.text()
.contains("HDP")
) "1080" else qualityRegex.find(it.text())?.destructured?.component1().toString()
qualities.add(
listOf(
ExtractorLink(
"Gogoanime",
if (qual == "null") "Gogoanime" else "Gogoanime - " + qual + "p",
decryptRedirect(it.attr("href")),
it.attr("href"),
page.url,
getQualityFromName(qual),
it.attr("href").contains(".m3u8"),
mapOf("Referer" to it.attr("href"))
it.attr("href").contains(".m3u8")
)
)
} else {
val url = it.attr("href")
val extractorLinks = ArrayList<ExtractorLink>()
for (api in extractorApis) {
if (url.startsWith(api.mainUrl)) {
qualities.addAll(api.getSafeUrl(url) ?: listOf())
extractorLinks.addAll(api.getSafeUrl(url) ?: listOf())
break
}
}
extractorLinks
}
}
return qualities
}.flatten()
}
override fun loadLinks(