From adbc96dfea80c13e6d34de9ae4f4d620f3b613f0 Mon Sep 17 00:00:00 2001 From: stevenyomi <95685115+stevenyomi@users.noreply.github.com> Date: Sun, 7 Sep 2025 20:51:16 +0000 Subject: [PATCH] Roumanwu: fix pages (#10441) --- src/zh/roumanwu/build.gradle | 2 +- .../extension/zh/roumanwu/Roumanwu.kt | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/zh/roumanwu/build.gradle b/src/zh/roumanwu/build.gradle index 1352e9466..e2e71cbfb 100644 --- a/src/zh/roumanwu/build.gradle +++ b/src/zh/roumanwu/build.gradle @@ -1,7 +1,7 @@ ext { extName = 'Roumanwu' extClass = '.Roumanwu' - extVersionCode = 17 + extVersionCode = 18 isNsfw = true } diff --git a/src/zh/roumanwu/src/eu/kanade/tachiyomi/extension/zh/roumanwu/Roumanwu.kt b/src/zh/roumanwu/src/eu/kanade/tachiyomi/extension/zh/roumanwu/Roumanwu.kt index bca917e15..48f9a0f16 100644 --- a/src/zh/roumanwu/src/eu/kanade/tachiyomi/extension/zh/roumanwu/Roumanwu.kt +++ b/src/zh/roumanwu/src/eu/kanade/tachiyomi/extension/zh/roumanwu/Roumanwu.kt @@ -15,6 +15,7 @@ import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.util.asJsoup import keiyoushi.utils.getPreferences import okhttp3.HttpUrl.Companion.toHttpUrl +import okhttp3.Request import okhttp3.Response import org.jsoup.nodes.Document import org.jsoup.nodes.Element @@ -143,16 +144,16 @@ class Roumanwu : HttpSource(), ConfigurableSource { return chapters } - override fun pageListParse(response: Response): List { - val images = response.asJsoup().selectFirst("script:containsData(imageUrl)")!!.data() - .let { content -> - """\\"imageUrl\\":\\"([^\\]+)""".toRegex() - .findAll(content).map { it.groups[1]?.value } - .toList() - } + override fun pageListRequest(chapter: SChapter): Request { + // Rendered HTML might have links sitting on the boundary of two scripts + return super.pageListRequest(chapter).newBuilder().addHeader("rsc", "1").build() + } - return images.mapIndexed { index, imageUrl -> - Page(index, imageUrl = imageUrl) + override fun pageListParse(response: Response): List { + val html = response.body.string() + val regex = Regex(""""imageUrl":"([^"]+)""") + return regex.findAll(html).mapIndexedTo(ArrayList()) { index, match -> + Page(index, imageUrl = match.groupValues[1]) } }