fixed 9anime

This commit is contained in:
LagradOst 2022-08-02 15:48:19 +02:00
parent c5406acc1e
commit e6c76262b2

View file

@ -20,25 +20,16 @@ class NineAnimeProvider : MainAPI() {
// taken from https://github.com/saikou-app/saikou/blob/b35364c8c2a00364178a472fccf1ab72f09815b4/app/src/main/java/ani/saikou/parsers/anime/NineAnime.kt // taken from https://github.com/saikou-app/saikou/blob/b35364c8c2a00364178a472fccf1ab72f09815b4/app/src/main/java/ani/saikou/parsers/anime/NineAnime.kt
// GNU General Public License v3.0 https://github.com/saikou-app/saikou/blob/main/LICENSE.md // GNU General Public License v3.0 https://github.com/saikou-app/saikou/blob/main/LICENSE.md
companion object { companion object {
fun getDubStatus(title: String): DubStatus {
return if (title.contains("(dub)", ignoreCase = true)) {
DubStatus.Dubbed
} else {
DubStatus.Subbed
}
}
private const val nineAnimeKey = private const val nineAnimeKey =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
private const val cipherKey = "rTKp3auwu0ULA6II" private const val cipherKey = "kMXzgyNzT3k5dYab"
fun encodeVrf(text: String, mainKey: String): String { fun encodeVrf(text: String, mainKey: String): String {
return encode( return encode(
encrypt( encrypt(
cipher(mainKey, encode(text)), cipher(mainKey, encode(text)),
nineAnimeKey nineAnimeKey
).replace("""=+$""".toRegex(), "") )//.replace("""=+$""".toRegex(), "")
) )
} }
@ -238,9 +229,10 @@ class NineAnimeProvider : MainAPI() {
?: throw ErrorLoadingException("Could not find title") ?: throw ErrorLoadingException("Could not find title")
val vrf = encodeVrf(id, cipherKey) val vrf = encodeVrf(id, cipherKey)
val req = app.get("$mainUrl/ajax/episode/list/$id?vrf=$vrf") val episodeListUrl = "$mainUrl/ajax/episode/list/$id?vrf=$vrf"
val body = req.parsedSafe<Response>()?.html val body =
?: throw ErrorLoadingException("Could not parse json with cipherKey=$cipherKey code=${req.code}") app.get(episodeListUrl).parsedSafe<Response>()?.html
?: throw ErrorLoadingException("Could not parse json with cipherKey=$cipherKey id=$id url=\n$episodeListUrl")
val subEpisodes = ArrayList<Episode>() val subEpisodes = ArrayList<Episode>()
val dubEpisodes = ArrayList<Episode>() val dubEpisodes = ArrayList<Episode>()