diff --git a/lib-multisrc/peachscan/build.gradle.kts b/lib-multisrc/peachscan/build.gradle.kts index c10d061f2..7c0e9df73 100644 --- a/lib-multisrc/peachscan/build.gradle.kts +++ b/lib-multisrc/peachscan/build.gradle.kts @@ -2,7 +2,7 @@ plugins { id("lib-multisrc") } -baseVersionCode = 5 +baseVersionCode = 6 dependencies { compileOnly("com.github.tachiyomiorg:image-decoder:e08e9be535") diff --git a/lib-multisrc/peachscan/src/eu/kanade/tachiyomi/multisrc/peachscan/PeachScan.kt b/lib-multisrc/peachscan/src/eu/kanade/tachiyomi/multisrc/peachscan/PeachScan.kt index 62cea1ed0..a5a6b8035 100644 --- a/lib-multisrc/peachscan/src/eu/kanade/tachiyomi/multisrc/peachscan/PeachScan.kt +++ b/lib-multisrc/peachscan/src/eu/kanade/tachiyomi/multisrc/peachscan/PeachScan.kt @@ -153,13 +153,16 @@ abstract class PeachScan( }.getOrDefault(0L) } + private val urlsRegex = """const\s+urls\s*=\s*\[(.*?)]\s*;""".toRegex() + override fun pageListParse(document: Document): List { - val scriptElement = document.selectFirst("script:containsData(const urls =[)") + val scriptElement = document.selectFirst("script:containsData(const urls)") ?: return document.select("#imageContainer img").mapIndexed { i, it -> Page(i, document.location(), it.attr("abs:src")) } - val urls = scriptElement.html().substringAfter("const urls =[").substringBefore("];") + val urls = urlsRegex.find(scriptElement.data())?.groupValues?.get(1) + ?: throw Exception("Could not find image URLs") return urls.split(",").mapIndexed { i, it -> Page(i, document.location(), baseUrl + it.trim().removeSurrounding("'") + "#page")