[MadTheme] Fix pages parsing #701

master
Koitharu 2 years ago
parent fb387dbcd9
commit 7829a2ad3b
Signed by: Koitharu
GPG Key ID: 676DEE768C17A9D7

@ -16,4 +16,3 @@ dependencyResolutionManagement {
rootProject.name = 'kotatsu-parsers'
include 'kotatsu-parsers-ksp'

@ -226,6 +226,21 @@ internal abstract class MadthemeParser(
val fullUrl = chapter.url.toAbsoluteUrl(domain)
val doc = webClient.httpGet(fullUrl).parseHtml()
val regexPages = Regex("chapImages\\s*=\\s*'(.*)'")
val pages = doc.select("script").firstNotNullOfOrNull { script ->
regexPages.find(script.html())?.groupValues?.getOrNull(1)
}?.split(',')
if (pages != null) {
return pages.map { url ->
MangaPage(
id = generateUid(url),
url = url,
preview = null,
source = source,
)
}
}
// fallback to html parisng
return doc.select(selectPage).map { img ->
val url = img.src()?.toRelativeUrl(domain) ?: img.parseFailed("Image src not found")
MangaPage(

Loading…
Cancel
Save