[BatoTo] Fix pages parsing

pull/38/head
Koitharu 4 years ago
parent 941cc61577
commit cb7a23950a
No known key found for this signature in database
GPG Key ID: 8E861F8CE6E7CE27

@ -105,7 +105,7 @@ internal class BatoToParser(override val context: MangaLoaderContext) : MangaPar
val scripts = context.httpGet(fullUrl).parseHtml().select("script") val scripts = context.httpGet(fullUrl).parseHtml().select("script")
for (script in scripts) { for (script in scripts) {
val scriptSrc = script.html() val scriptSrc = script.html()
val p = scriptSrc.indexOf("const images =") val p = scriptSrc.indexOf("const imgHttpLis =")
if (p == -1) continue if (p == -1) continue
val start = scriptSrc.indexOf('[', p) val start = scriptSrc.indexOf('[', p)
val end = scriptSrc.indexOf(';', start) val end = scriptSrc.indexOf(';', start)
@ -113,19 +113,19 @@ internal class BatoToParser(override val context: MangaLoaderContext) : MangaPar
continue continue
} }
val images = JSONArray(scriptSrc.substring(start, end)) val images = JSONArray(scriptSrc.substring(start, end))
val batoJs = scriptSrc.substringBetweenFirst("batojs =", ";")?.trim(' ', '"', '\n') val batoPass = scriptSrc.substringBetweenFirst("batoPass =", ";")?.trim(' ', '"', '\n')
?: parseFailed("Cannot find batojs") ?: parseFailed("Cannot find batoPass")
val server = scriptSrc.substringBetweenFirst("server =", ";")?.trim(' ', '"', '\n') val batoWord = scriptSrc.substringBetweenFirst("batoWord =", ";")?.trim(' ', '"', '\n')
?: parseFailed("Cannot find server") ?: parseFailed("Cannot find batoWord")
val password = context.evaluateJs(batoJs)?.removeSurrounding('"') val password = context.evaluateJs(batoPass)?.removeSurrounding('"')
?: parseFailed("Cannot evaluate batojs") ?: parseFailed("Cannot evaluate batoPass")
val serverDecrypted = decryptAES(server, password).removeSurrounding('"') val args = JSONArray(decryptAES(batoWord, password))
val result = ArrayList<MangaPage>(images.length()) val result = ArrayList<MangaPage>(images.length())
repeat(images.length()) { i -> repeat(images.length()) { i ->
val url = images.getString(i) val url = images.getString(i)
result += MangaPage( result += MangaPage(
id = generateUid(url), id = generateUid(url),
url = if (url.startsWith("http")) url else "$serverDecrypted$url", url = url + "?" + args.getString(i),
referer = fullUrl, referer = fullUrl,
preview = null, preview = null,
source = source, source = source,

Loading…
Cancel
Save