Roumanwu: fix pages (#10441)

This commit is contained in:
stevenyomi 2025-09-07 20:51:16 +00:00 committed by Draff
parent 361f7e2c92
commit adbc96dfea
Signed by: Draff
GPG Key ID: E8A89F3211677653
2 changed files with 11 additions and 10 deletions

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'Roumanwu' extName = 'Roumanwu'
extClass = '.Roumanwu' extClass = '.Roumanwu'
extVersionCode = 17 extVersionCode = 18
isNsfw = true isNsfw = true
} }

View File

@ -15,6 +15,7 @@ import eu.kanade.tachiyomi.source.online.HttpSource
import eu.kanade.tachiyomi.util.asJsoup import eu.kanade.tachiyomi.util.asJsoup
import keiyoushi.utils.getPreferences import keiyoushi.utils.getPreferences
import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.Request
import okhttp3.Response import okhttp3.Response
import org.jsoup.nodes.Document import org.jsoup.nodes.Document
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
@ -143,16 +144,16 @@ class Roumanwu : HttpSource(), ConfigurableSource {
return chapters return chapters
} }
override fun pageListParse(response: Response): List<Page> { override fun pageListRequest(chapter: SChapter): Request {
val images = response.asJsoup().selectFirst("script:containsData(imageUrl)")!!.data() // Rendered HTML might have links sitting on the boundary of two scripts
.let { content -> return super.pageListRequest(chapter).newBuilder().addHeader("rsc", "1").build()
"""\\"imageUrl\\":\\"([^\\]+)""".toRegex() }
.findAll(content).map { it.groups[1]?.value }
.toList()
}
return images.mapIndexed { index, imageUrl -> override fun pageListParse(response: Response): List<Page> {
Page(index, imageUrl = imageUrl) val html = response.body.string()
val regex = Regex(""""imageUrl":"([^"]+)""")
return regex.findAll(html).mapIndexedTo(ArrayList()) { index, match ->
Page(index, imageUrl = match.groupValues[1])
} }
} }