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'
pkgNameSuffix = 'all.animeonsen'
extClass = '.AnimeOnsen'
extVersionCode = 2
extVersionCode = 3
libVersion = '13'
}

View File

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

View File

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

View File

@ -6,7 +6,7 @@ import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.jsonPrimitive
const val fallbackcipherKey = "xtbmecCv4faAOSLV"
const val fallbackcipherKey = "mcYrOtBqfRISotfM"
const val fallbackdecipherKey = "hlPeNwkncH0fq9so"
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 val cipherKey: String
private val decipherKey: String
init {
private val keys by lazy {
val allJsScript = runBlocking {
client.newCall(
GET(
@ -385,9 +382,13 @@ class NineAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
)
).execute().body!!.string()
}
val keys = getKeys(allJsScript, json)
cipherKey = keys.first
decipherKey = keys.second
getKeys(allJsScript, json)
}
private val cipherKey by lazy {
keys.first
}
private val decipherKey by lazy {
keys.second
}
}