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> { private fun extractVideos(uri: String): List<ExtractorLink> {
val html = get(uri).text val html = get(uri).text
val doc = Jsoup.parse(html) val doc = Jsoup.parse(html)
@ -234,38 +212,36 @@ class GogoanimeProvider : MainAPI() {
val iframe = "https:" + doc.selectFirst("div.play-video > iframe").attr("src") val iframe = "https:" + doc.selectFirst("div.play-video > iframe").attr("src")
val link = iframe.replace("streaming.php", "download") 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 pageDoc = Jsoup.parse(page.text)
val qualities = ArrayList<ExtractorLink>() return pageDoc.select(".dowload > a").pmap {
pageDoc.select(".dowload > a").pmap {
if (it.hasAttr("download")) { if (it.hasAttr("download")) {
val qual = if (it.text() val qual = if (it.text()
.contains("HDP") .contains("HDP")
) "1080" else qualityRegex.find(it.text())?.destructured?.component1().toString() ) "1080" else qualityRegex.find(it.text())?.destructured?.component1().toString()
qualities.add( listOf(
ExtractorLink( ExtractorLink(
"Gogoanime", "Gogoanime",
if (qual == "null") "Gogoanime" else "Gogoanime - " + qual + "p", if (qual == "null") "Gogoanime" else "Gogoanime - " + qual + "p",
decryptRedirect(it.attr("href")), it.attr("href"),
page.url, page.url,
getQualityFromName(qual), getQualityFromName(qual),
it.attr("href").contains(".m3u8"), it.attr("href").contains(".m3u8")
mapOf("Referer" to it.attr("href"))
) )
) )
} else { } else {
val url = it.attr("href") val url = it.attr("href")
val extractorLinks = ArrayList<ExtractorLink>()
for (api in extractorApis) { for (api in extractorApis) {
if (url.startsWith(api.mainUrl)) { if (url.startsWith(api.mainUrl)) {
qualities.addAll(api.getSafeUrl(url) ?: listOf()) extractorLinks.addAll(api.getSafeUrl(url) ?: listOf())
break break
} }
} }
extractorLinks
} }
} }.flatten()
return qualities
} }
override fun loadLinks( override fun loadLinks(