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