From 8ed0f0728a1029405ec4d4b0a633f922d4d851aa Mon Sep 17 00:00:00 2001 From: Yong Su Lee Date: Tue, 14 May 2019 22:24:04 -0400 Subject: [PATCH] ComicExtra doesn't show chapters from multiple pages (#1107) ComicExtra doesn't show chapters from multiple pages --- src/en/comicextra/build.gradle | 2 +- .../extension/en/comicextra/ComicExtra.kt | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/en/comicextra/build.gradle b/src/en/comicextra/build.gradle index b8f1ef12d..a8433e6ec 100644 --- a/src/en/comicextra/build.gradle +++ b/src/en/comicextra/build.gradle @@ -5,7 +5,7 @@ ext { appName = 'Tachiyomi: ComicExtra' pkgNameSuffix = 'en.comicextra' extClass = '.ComicExtra' - extVersionCode = 2 + extVersionCode = 3 libVersion = '1.2' } diff --git a/src/en/comicextra/src/eu/kanade/tachiyomi/extension/en/comicextra/ComicExtra.kt b/src/en/comicextra/src/eu/kanade/tachiyomi/extension/en/comicextra/ComicExtra.kt index 772dda1ff..4380bdc56 100644 --- a/src/en/comicextra/src/eu/kanade/tachiyomi/extension/en/comicextra/ComicExtra.kt +++ b/src/en/comicextra/src/eu/kanade/tachiyomi/extension/en/comicextra/ComicExtra.kt @@ -52,6 +52,8 @@ class ComicExtra : ParsedHttpSource() { private fun fetchThumbnailURL(url: String) = client.newCall(GET(url, headers)).execute().asJsoup().select("div.movie-l-img > img").attr("src") + private fun fetchChaptersFromNav(url: String) = client.newCall(GET(url, headers)).execute().asJsoup().select(chapterListSelector()) + override fun popularMangaNextPageSelector() = "div.general-nav > a:contains(Next)" override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector() @@ -71,6 +73,7 @@ class ComicExtra : ParsedHttpSource() { manga.status = parseStatus(status) manga.author = document.select("dt:contains(Author:) + dd").text() manga.description = document.select("div#film-content").text() + return manga } @@ -80,6 +83,33 @@ class ComicExtra : ParsedHttpSource() { else -> SManga.UNKNOWN } + override fun chapterListParse(response: Response): List { + + val document = response.asJsoup() + val nav = document.getElementsByClass("general-nav").first() + val chapters = ArrayList() + + document.select(chapterListSelector()).forEach { + chapters.add(chapterFromElement(it)) + } + + if (nav == null) { + return chapters + } + + val links = nav.getElementsByTag("a") + + links.forEach { + if (it.text() != "Next") { + fetchChaptersFromNav(it.attr("href")).forEach { page -> + chapters.add(chapterFromElement(page)) + } + } + } + + return chapters + } + override fun chapterListSelector() = "table.table > tbody#list > tr:has(td)" override fun chapterFromElement(element: Element): SChapter {