gogoanime: fix dood extractor (#355)
This commit is contained in:
@ -5,7 +5,7 @@ ext {
|
||||
extName = 'Gogoanime'
|
||||
pkgNameSuffix = 'en.gogoanime'
|
||||
extClass = '.GogoAnime'
|
||||
extVersionCode = 26
|
||||
extVersionCode = 27
|
||||
libVersion = '12'
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ class GogoAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
|
||||
override val name = "Gogoanime"
|
||||
|
||||
override val baseUrl = "https://www3.gogoanime.cm"
|
||||
override val baseUrl = "https://gogoanime.film/"
|
||||
|
||||
override val lang = "en"
|
||||
|
||||
@ -90,10 +90,11 @@ class GogoAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
val document = response.asJsoup()
|
||||
val serverUrl = "https:" + document.select("div.anime_muti_link > ul > li.vidcdn > a")
|
||||
.attr("data-video")
|
||||
|
||||
val dodoURL = document.select("div.anime_muti_link > ul > li.doodstream > a")
|
||||
.attr("data-video")
|
||||
val gogoVideos = GogoCdnExtractor(client, json).videosFromUrl(serverUrl)
|
||||
return if (gogoVideos.isEmpty()) {
|
||||
DoodExtractor(client).videosFromUrl(serverUrl)
|
||||
DoodExtractor(client).videosFromUrl(dodoURL)
|
||||
} else {
|
||||
gogoVideos
|
||||
}
|
||||
|
@ -1,17 +1,15 @@
|
||||
package eu.kanade.tachiyomi.animeextension.en.gogoanime.extractors
|
||||
|
||||
import android.util.Log
|
||||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import okhttp3.Headers
|
||||
import okhttp3.OkHttpClient
|
||||
|
||||
class DoodExtractor(private val client: OkHttpClient) {
|
||||
fun videosFromUrl(serverUrl: String): List<Video> {
|
||||
val url = client.newCall(GET(serverUrl)).execute().asJsoup()
|
||||
.select("li.linkserver[data-video*=dood]").attr("data-video")
|
||||
val response = client.newCall(GET(url)).execute()
|
||||
val doodTld = url.substringAfter("https://dood.").substringBefore("/")
|
||||
val response = client.newCall(GET(serverUrl)).execute()
|
||||
val doodTld = serverUrl.substringAfter("https://dood.").substringBefore("/")
|
||||
val content = response.body!!.string()
|
||||
if (!content.contains("'/pass_md5/")) return emptyList()
|
||||
val md5 = content.substringAfter("'/pass_md5/").substringBefore("',")
|
||||
@ -21,12 +19,11 @@ class DoodExtractor(private val client: OkHttpClient) {
|
||||
val videoUrlStart = client.newCall(
|
||||
GET(
|
||||
"https://dood.$doodTld/pass_md5/$md5",
|
||||
Headers.headersOf("referer", url)
|
||||
Headers.headersOf("referer", serverUrl)
|
||||
)
|
||||
).execute().body!!.string()
|
||||
val videoUrl = "$videoUrlStart$randomString?token=$token&expiry=$expiry"
|
||||
|
||||
return listOf(Video(url, "Doodstream mirror", videoUrl, null, doodHeaders(doodTld)))
|
||||
return listOf(Video(serverUrl, "Doodstream mirror", videoUrl, null, doodHeaders(doodTld)))
|
||||
}
|
||||
|
||||
private fun getRandomString(length: Int = 10): String {
|
||||
|
@ -26,8 +26,10 @@ class GogoCdnExtractor(private val client: OkHttpClient, private val json: Json)
|
||||
val serverResponse = client.newCall(GET(serverUrl)).execute().asJsoup()
|
||||
|
||||
val encrypted = serverResponse.select("script[data-name='crypto']").attr("data-value")
|
||||
val iv = serverResponse.select("script[data-name='ts']").attr("data-value").toByteArray()
|
||||
val id = serverUrl.toHttpUrl().queryParameter("id") ?: throw Exception("error decrypting")
|
||||
val iv =
|
||||
serverResponse.select("script[data-name='ts']").attr("data-value").toByteArray()
|
||||
val id =
|
||||
serverUrl.toHttpUrl().queryParameter("id") ?: throw Exception("error decrypting")
|
||||
val secretKey = cryptoHandler(encrypted, iv, iv + iv, false)
|
||||
|
||||
val encryptedId =
|
||||
@ -46,14 +48,29 @@ class GogoCdnExtractor(private val client: OkHttpClient, private val json: Json)
|
||||
.trim('"').replace(" ", "")
|
||||
val fileURL = it.jsonObject["file"].toString().trim('"')
|
||||
val videoHeaders = Headers.headersOf("Referer", serverUrl)
|
||||
if (label == "auto") autoList.add(Video(fileURL, label, fileURL, null, videoHeaders))
|
||||
if (label == "auto") autoList.add(
|
||||
Video(
|
||||
fileURL,
|
||||
label,
|
||||
fileURL,
|
||||
null,
|
||||
videoHeaders
|
||||
)
|
||||
)
|
||||
else videoList.add(Video(fileURL, label, fileURL, null, videoHeaders))
|
||||
}
|
||||
return videoList.reversed() + autoList
|
||||
} catch (e: Exception) { return emptyList() }
|
||||
} catch (e: Exception) {
|
||||
return emptyList()
|
||||
}
|
||||
}
|
||||
|
||||
private fun cryptoHandler(string: String, iv: ByteArray, secretKeyString: ByteArray, encrypt: Boolean = true): String {
|
||||
private fun cryptoHandler(
|
||||
string: String,
|
||||
iv: ByteArray,
|
||||
secretKeyString: ByteArray,
|
||||
encrypt: Boolean = true
|
||||
): String {
|
||||
val ivParameterSpec = IvParameterSpec(iv)
|
||||
val secretKey = SecretKeySpec(secretKeyString, "AES")
|
||||
val cipher = Cipher.getInstance("AES/CBC/PKCS5Padding")
|
||||
|
Reference in New Issue
Block a user