diff --git a/src/en/comicextra/build.gradle b/src/en/comicextra/build.gradle index 7d8963e03..b3708b700 100644 --- a/src/en/comicextra/build.gradle +++ b/src/en/comicextra/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'ComicExtra' pkgNameSuffix = 'en.comicextra' extClass = '.ComicExtra' - extVersionCode = 6 + extVersionCode = 7 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 5cb1c0fd7..8ba50afca 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 @@ -71,7 +71,7 @@ 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()) + private fun fetchPagesFromNav(url: String) = client.newCall(GET(url, headers)).execute().asJsoup() override fun popularMangaNextPageSelector() = "div.general-nav > a:contains(Next)" @@ -114,16 +114,21 @@ class ComicExtra : ParsedHttpSource() { return chapters } - val links = nav.getElementsByTag("a") + val pg2url = nav.select("a:contains(next)").attr("href") - links.forEach { - if (it.text() != "Next") { - fetchChaptersFromNav(it.attr("href")).forEach { page -> - chapters.add(chapterFromElement(page)) - } + // recursively build the chapter list + + fun parseChapters(nextURL: String) { + val newpage = fetchPagesFromNav(nextURL) + newpage.select(chapterListSelector()).forEach { + chapters.add(chapterFromElement(it)) } + val newURL = newpage.select(".general-nav a:contains(next)")?.attr("href") + if (!newURL.isNullOrBlank()) parseChapters(newURL) } + parseChapters(pg2url) + return chapters }