Fix pages not found in some chapters at LM (#18753)
Fix pages not found in some chapters at LM.
This commit is contained in:
parent
7561fc4606
commit
83719416e8
@ -6,7 +6,7 @@ ext {
|
|||||||
extName = 'Ler Mangá'
|
extName = 'Ler Mangá'
|
||||||
pkgNameSuffix = 'pt.lermanga'
|
pkgNameSuffix = 'pt.lermanga'
|
||||||
extClass = '.LerManga'
|
extClass = '.LerManga'
|
||||||
extVersionCode = 1
|
extVersionCode = 2
|
||||||
isNsfw = true
|
isNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,11 +101,21 @@ class LerManga : ParsedHttpSource() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun pageListParse(document: Document): List<Page> {
|
override fun pageListParse(document: Document): List<Page> {
|
||||||
return document.selectFirst("h1.heading-header + script[src^=data]")!!
|
val pagesScript = document.selectFirst("h1.heading-header + script")
|
||||||
.attr("src")
|
?: return emptyList()
|
||||||
.substringAfter("base64,")
|
|
||||||
.let { Base64.decode(it, Base64.DEFAULT).toString(charset("UTF-8")) }
|
val pagesJson = when {
|
||||||
.substringAfter("var imagens_cap=")
|
pagesScript.hasAttr("src") -> {
|
||||||
|
pagesScript.attr("src")
|
||||||
|
.substringAfter("base64,")
|
||||||
|
.let { Base64.decode(it, Base64.DEFAULT).toString(Charsets.UTF_8) }
|
||||||
|
}
|
||||||
|
else -> pagesScript.data()
|
||||||
|
}
|
||||||
|
|
||||||
|
return pagesJson
|
||||||
|
.replace(PAGES_VARIABLE_REGEX, "")
|
||||||
|
.substringBeforeLast(";")
|
||||||
.let { json.decodeFromString<List<String>>(it) }
|
.let { json.decodeFromString<List<String>>(it) }
|
||||||
.mapIndexed { index, imageUrl ->
|
.mapIndexed { index, imageUrl ->
|
||||||
Page(index, document.location(), imageUrl)
|
Page(index, document.location(), imageUrl)
|
||||||
@ -133,6 +143,7 @@ class LerManga : ParsedHttpSource() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
private val PAGES_VARIABLE_REGEX = "var imagens_cap\\s*=\\s*".toRegex()
|
||||||
private val DATE_FORMATTER by lazy {
|
private val DATE_FORMATTER by lazy {
|
||||||
SimpleDateFormat("dd-MM-yyyy", Locale("pt", "BR"))
|
SimpleDateFormat("dd-MM-yyyy", Locale("pt", "BR"))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user