LeerCapitulo: Fix index out of bound (#16211)
* Fix index * Deobfuscating this was hard
This commit is contained in:
parent
037191ea8f
commit
6a390b749c
|
@ -6,7 +6,7 @@ ext {
|
||||||
extName = 'LeerCapitulo / OlympusScan.top'
|
extName = 'LeerCapitulo / OlympusScan.top'
|
||||||
pkgNameSuffix = 'es.leercapitulo'
|
pkgNameSuffix = 'es.leercapitulo'
|
||||||
extClass = '.LeerCapitulo'
|
extClass = '.LeerCapitulo'
|
||||||
extVersionCode = 3
|
extVersionCode = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
|
@ -1,6 +1,7 @@
|
||||||
package eu.kanade.tachiyomi.extension.es.leercapitulo
|
package eu.kanade.tachiyomi.extension.es.leercapitulo
|
||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
|
import android.util.Base64
|
||||||
import androidx.preference.ListPreference
|
import androidx.preference.ListPreference
|
||||||
import androidx.preference.PreferenceScreen
|
import androidx.preference.PreferenceScreen
|
||||||
import eu.kanade.tachiyomi.extension.es.leercapitulo.dto.MangaDto
|
import eu.kanade.tachiyomi.extension.es.leercapitulo.dto.MangaDto
|
||||||
|
@ -22,6 +23,7 @@ import org.jsoup.nodes.Element
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
|
import java.nio.charset.Charset
|
||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
|
|
||||||
class LeerCapitulo : ParsedHttpSource(), ConfigurableSource {
|
class LeerCapitulo : ParsedHttpSource(), ConfigurableSource {
|
||||||
|
@ -147,14 +149,23 @@ class LeerCapitulo : ParsedHttpSource(), ConfigurableSource {
|
||||||
|
|
||||||
// Pages
|
// Pages
|
||||||
override fun pageListParse(document: Document): List<Page> {
|
override fun pageListParse(document: Document): List<Page> {
|
||||||
val order = 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 urls = document.selectFirst("#arraydata")!!.text().split(',')
|
|
||||||
val sortedUrl = order?.map { urls[it.toInt()] } ?: urls
|
|
||||||
|
|
||||||
return sortedUrl.mapIndexed { i, image_url ->
|
val arrayData = document.selectFirst("#arraydata")!!.text()
|
||||||
Page(i, imageUrl = image_url.replace("https://cdn.statically.io/img/", "https://")) // just redirects
|
|
||||||
|
val encodedUrls = arrayData.replace(Regex("[A-Z0-9]", RegexOption.IGNORE_CASE)) {
|
||||||
|
val index = "BoevQJylkhcAxZVb4sXTgfaHu3zr7tP61L9qGNUmCpYKREdijD28OSwWInF5M0".indexOf(it.value)
|
||||||
|
"GQiMUkPrKIgpzVcu87AY4LnvO2a0oBy9JFbRhSx6qdfme5wZsEWlT1CN3XjDHt"[index].toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
val urlList = String(Base64.decode(encodedUrls, Base64.DEFAULT), Charset.forName("UTF-8")).split(",")
|
||||||
|
|
||||||
|
val sortedUrls = orderList?.map { urlList[it.reversed().toInt()] }?.reversed() ?: urlList
|
||||||
|
|
||||||
|
return sortedUrls.mapIndexed { i, image_url ->
|
||||||
|
Page(i, imageUrl = image_url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue