diff --git a/src/zh/baozimanhua/CHANGELOG.md b/src/zh/baozimanhua/CHANGELOG.md index 6898b261d..dc8010cb2 100644 --- a/src/zh/baozimanhua/CHANGELOG.md +++ b/src/zh/baozimanhua/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.3.13 (2022-11-09) + +- 修复章节目录和图片分页 + ## 1.3.12 (2022-07-23) - 适配章节分页的重叠区域,修复图片重复、缺页的问题 diff --git a/src/zh/baozimanhua/build.gradle b/src/zh/baozimanhua/build.gradle index f109ac69d..cafb98730 100644 --- a/src/zh/baozimanhua/build.gradle +++ b/src/zh/baozimanhua/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'Baozi Manhua' pkgNameSuffix = 'zh.baozimanhua' extClass = '.Baozi' - extVersionCode = 12 + extVersionCode = 13 } apply from: "$rootDir/common.gradle" diff --git a/src/zh/baozimanhua/src/eu/kanade/tachiyomi/extension/zh/baozimanhua/Baozi.kt b/src/zh/baozimanhua/src/eu/kanade/tachiyomi/extension/zh/baozimanhua/Baozi.kt index 75572c1f5..ab6d68961 100644 --- a/src/zh/baozimanhua/src/eu/kanade/tachiyomi/extension/zh/baozimanhua/Baozi.kt +++ b/src/zh/baozimanhua/src/eu/kanade/tachiyomi/extension/zh/baozimanhua/Baozi.kt @@ -23,7 +23,6 @@ import org.jsoup.nodes.Document import org.jsoup.nodes.Element import org.jsoup.select.Evaluator import rx.Observable -import rx.Single import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import java.text.SimpleDateFormat @@ -57,11 +56,12 @@ class Baozi : ParsedHttpSource(), ConfigurableSource { override fun chapterListParse(response: Response): List { val document = response.asJsoup() - return if (document.select(".l-box > .pure-g").size == 1) { // only latest chapters - document.select(".l-box > .pure-g > div") + val fullListTitle = document.selectFirst(".section-title:containsOwn(章节目录)") + return if (fullListTitle == null) { // only latest chapters + document.select(Evaluator.Class("comics-chapters")) } else { // chapters are listed oldest to newest in the source - document.select(".l-box > .pure-g[id^=chapter] > div").reversed() + fullListTitle.parent().select(Evaluator.Class("comics-chapters")).reversed() }.map { chapterFromElement(it) }.apply { val chapterOrderPref = preferences.getString(CHAPTER_ORDER_PREF, CHAPTER_ORDER_DISABLED) if (chapterOrderPref != CHAPTER_ORDER_DISABLED) { @@ -132,28 +132,22 @@ class Baozi : ParsedHttpSource(), ConfigurableSource { } } - override fun fetchPageList(chapter: SChapter): Observable> = Single.create> { + override fun fetchPageList(chapter: SChapter): Observable> = Observable.fromCallable { val pageNumberSelector = Evaluator.Class("comic-text__amp") val pageList = ArrayList(0) var url = baseUrl + chapter.url - var pageCount = 0 var i = 0 - do { + while (true) { val document = client.newCall(GET(url, headers)).execute().asJsoup() - if (i == 0) { - pageCount = document.selectFirst(pageNumberSelector) - ?.run { text().substringAfter('/').toInt() } ?: break - pageList.ensureCapacity(pageCount) - } 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 - } while (i < pageCount) - it.onSuccess(pageList) - }.toObservable() + } + pageList + } override fun pageListParse(document: Document) = throw UnsupportedOperationException("Not used.")