Baozi Manhua: chapter image pagination overlap (#12703)

This commit is contained in:
stevenyomi 2022-07-23 22:56:53 +08:00 committed by GitHub
parent 69aec03657
commit 1fe1da7b02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

View File

@ -1,3 +1,7 @@
## 1.3.12 (2022-07-23)
- 适配章节分页的重叠区域,修复图片重复、缺页的问题
## 1.3.11 (2022-07-21)
- 增加设置项:修复章节顺序错误导致的错标已读

View File

@ -5,7 +5,7 @@ ext {
extName = 'Baozi Manhua'
pkgNameSuffix = 'zh.baozimanhua'
extClass = '.Baozi'
extVersionCode = 11
extVersionCode = 12
}
apply from: "$rootDir/common.gradle"

View File

@ -133,6 +133,7 @@ class Baozi : ParsedHttpSource(), ConfigurableSource {
}
override fun fetchPageList(chapter: SChapter): Observable<List<Page>> = Single.create<List<Page>> {
val pageNumberSelector = Evaluator.Class("comic-text__amp")
val pageList = ArrayList<Page>(0)
var url = baseUrl + chapter.url
var pageCount = 0
@ -140,11 +141,13 @@ class Baozi : ParsedHttpSource(), ConfigurableSource {
do {
val document = client.newCall(GET(url, headers)).execute().asJsoup()
if (i == 0) {
pageCount = document.selectFirst(Evaluator.Class("comic-text__amp"))
pageCount = document.selectFirst(pageNumberSelector)
?.run { text().substringAfter('/').toInt() } ?: break
pageList.ensureCapacity(pageCount)
}
document.select(".comic-contain amp-img").mapTo(pageList) { element ->
document.select(".comic-contain amp-img").dropWhile { element ->
element.selectFirst(pageNumberSelector).text().substringBefore('/').toInt() <= i
}.mapTo(pageList) { element ->
Page(i++, imageUrl = element.attr("src"))
}
url = document.selectFirst(Evaluator.Id("next-chapter"))?.attr("href") ?: break