fix(en/cloudrecess): Fix chapter list on entries with 100+ chapters (#19442)
* fix: Fix chapter list on entries with 100+ chapters * chore: Bump version
This commit is contained in:
parent
4763371472
commit
cab16d3f2b
|
@ -5,7 +5,7 @@ ext {
|
|||
extName = 'CloudRecess'
|
||||
pkgNameSuffix = 'en.cloudrecess'
|
||||
extClass = '.CloudRecess'
|
||||
extVersionCode = 1
|
||||
extVersionCode = 2
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
|
|
|
@ -128,6 +128,27 @@ class CloudRecess : ParsedHttpSource() {
|
|||
// ============================== Chapters ==============================
|
||||
override fun chapterListSelector() = "div#chapters-list > a[href]"
|
||||
|
||||
override fun chapterListParse(response: Response): List<SChapter> {
|
||||
val originalUrl = response.request.url.toString()
|
||||
|
||||
val chapterList = buildList {
|
||||
var page = 1
|
||||
do {
|
||||
val doc = when {
|
||||
isEmpty() -> response // First page
|
||||
else -> {
|
||||
page++
|
||||
client.newCall(GET("$originalUrl?page=$page", headers)).execute()
|
||||
}
|
||||
}.use { it.asJsoup() }
|
||||
|
||||
addAll(doc.select(chapterListSelector()).map(::chapterFromElement))
|
||||
} while (doc.selectFirst(latestUpdatesNextPageSelector()) != null)
|
||||
}
|
||||
|
||||
return chapterList
|
||||
}
|
||||
|
||||
override fun chapterFromElement(element: Element) = SChapter.create().apply {
|
||||
setUrlWithoutDomain(element.attr("href"))
|
||||
name = element.selectFirst("span")?.ownText() ?: "Chapter"
|
||||
|
|
Loading…
Reference in New Issue