9anime, animeonsen: fix init

This commit is contained in:
jmir1
2022-08-23 21:11:10 +02:00
parent 88590128a6
commit 1cabd5c7cc
5 changed files with 16 additions and 14 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'AnimeOnsen' extName = 'AnimeOnsen'
pkgNameSuffix = 'all.animeonsen' pkgNameSuffix = 'all.animeonsen'
extClass = '.AnimeOnsen' extClass = '.AnimeOnsen'
extVersionCode = 2 extVersionCode = 3
libVersion = '13' libVersion = '13'
} }

View File

@ -20,7 +20,6 @@ import kotlinx.serialization.json.Json
import kotlinx.serialization.json.boolean import kotlinx.serialization.json.boolean
import kotlinx.serialization.json.jsonPrimitive import kotlinx.serialization.json.jsonPrimitive
import okhttp3.Headers import okhttp3.Headers
import okhttp3.OkHttpClient
import okhttp3.Request import okhttp3.Request
import okhttp3.Response import okhttp3.Response
import rx.Observable import rx.Observable
@ -40,9 +39,11 @@ class AnimeOnsen : AnimeHttpSource() {
private val cfClient = network.cloudflareClient private val cfClient = network.cloudflareClient
override val client: OkHttpClient = network.client.newBuilder() override val client by lazy {
.addInterceptor(AOAPIInterceptor(cfClient)) network.client.newBuilder()
.build() .addInterceptor(AOAPIInterceptor(cfClient))
.build()
}
private val json = Json { private val json = Json {
ignoreUnknownKeys = true ignoreUnknownKeys = true

View File

@ -5,7 +5,7 @@ ext {
extName = '9anime' extName = '9anime'
pkgNameSuffix = 'en.nineanime' pkgNameSuffix = 'en.nineanime'
extClass = '.NineAnime' extClass = '.NineAnime'
extVersionCode = 21 extVersionCode = 22
libVersion = '13' libVersion = '13'
} }

View File

@ -6,7 +6,7 @@ import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonObject import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.jsonPrimitive import kotlinx.serialization.json.jsonPrimitive
const val fallbackcipherKey = "xtbmecCv4faAOSLV" const val fallbackcipherKey = "mcYrOtBqfRISotfM"
const val fallbackdecipherKey = "hlPeNwkncH0fq9so" const val fallbackdecipherKey = "hlPeNwkncH0fq9so"
fun getKeys(allJsScript: String, json: Json): Pair<String, String> { fun getKeys(allJsScript: String, json: Json): Pair<String, String> {

View File

@ -373,10 +373,7 @@ class NineAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
private fun decode(input: String): String = java.net.URLDecoder.decode(input, "utf-8") private fun decode(input: String): String = java.net.URLDecoder.decode(input, "utf-8")
private val cipherKey: String private val keys by lazy {
private val decipherKey: String
init {
val allJsScript = runBlocking { val allJsScript = runBlocking {
client.newCall( client.newCall(
GET( GET(
@ -385,9 +382,13 @@ class NineAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
) )
).execute().body!!.string() ).execute().body!!.string()
} }
val keys = getKeys(allJsScript, json) getKeys(allJsScript, json)
cipherKey = keys.first }
decipherKey = keys.second private val cipherKey by lazy {
keys.first
}
private val decipherKey by lazy {
keys.second
} }
} }