Fix LeerCapitulo (#16245)

* Fix

* Apply requested changes

Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>

* Remove unused import

Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>

* Change delimiter

---------

Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
This commit is contained in:
seew3l 2023-04-30 16:29:22 -05:00 committed by GitHub
parent 03b25466be
commit 2e68fc15f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'LeerCapitulo / OlympusScan.top' extName = 'LeerCapitulo / OlympusScan.top'
pkgNameSuffix = 'es.leercapitulo' pkgNameSuffix = 'es.leercapitulo'
extClass = '.LeerCapitulo' extClass = '.LeerCapitulo'
extVersionCode = 4 extVersionCode = 5
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -146,23 +146,29 @@ class LeerCapitulo : ParsedHttpSource(), ConfigurableSource {
.toFloatOrNull() .toFloatOrNull()
?: -1f ?: -1f
} }
private val keyRepoUrl = "https://raw.githubusercontent.com/seew3l/tachiyomi-scripts/main/leercapitulo_keys.txt"
// Pages
override fun pageListParse(document: Document): List<Page> { override fun pageListParse(document: Document): List<Page> {
val orderList = document.selectFirst("meta[property=ad:check]")?.attr("content") val orderList = document.selectFirst("meta[property=ad:check]")?.attr("content")
?.replace("[^\\d]+".toRegex(), "-") ?.replace("[^\\d]+".toRegex(), "-")
?.split("-") ?.split("-")
val useReversedString = orderList?.any { it == "01" }
val arrayData = document.selectFirst("#arraydata")!!.text() val arrayData = document.selectFirst("#arraydata")!!.text()
val (key1, key2) = client.newCall(GET(keyRepoUrl)).execute().body.string().split("\n")
val encodedUrls = arrayData.replace(Regex("[A-Z0-9]", RegexOption.IGNORE_CASE)) { val encodedUrls = arrayData.replace(Regex("[A-Z0-9]", RegexOption.IGNORE_CASE)) {
val index = "BoevQJylkhcAxZVb4sXTgfaHu3zr7tP61L9qGNUmCpYKREdijD28OSwWInF5M0".indexOf(it.value) val index = key2.indexOf(it.value)
"GQiMUkPrKIgpzVcu87AY4LnvO2a0oBy9JFbRhSx6qdfme5wZsEWlT1CN3XjDHt"[index].toString() key1[index].toString()
} }
val urlList = String(Base64.decode(encodedUrls, Base64.DEFAULT), Charset.forName("UTF-8")).split(",") val urlList = String(Base64.decode(encodedUrls, Base64.DEFAULT), Charset.forName("UTF-8")).split(",")
val sortedUrls = orderList?.map { urlList[it.reversed().toInt()] }?.reversed() ?: urlList val sortedUrls = orderList?.map {
if (useReversedString == true) urlList[it.reversed().toInt()] else urlList[it.toInt()]
}?.reversed() ?: urlList
return sortedUrls.mapIndexed { i, image_url -> return sortedUrls.mapIndexed { i, image_url ->
Page(i, imageUrl = image_url) Page(i, imageUrl = image_url)