Changes Chapter Fetch (#5999)

- Use recursive fetching to ensure all pages are processed
This commit is contained in:
happywillow0 2021-02-27 20:45:53 -05:00 committed by GitHub
parent be115f2f5d
commit 05792a34e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 8 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'ComicExtra' extName = 'ComicExtra'
pkgNameSuffix = 'en.comicextra' pkgNameSuffix = 'en.comicextra'
extClass = '.ComicExtra' extClass = '.ComicExtra'
extVersionCode = 6 extVersionCode = 7
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -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 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)" override fun popularMangaNextPageSelector() = "div.general-nav > a:contains(Next)"
@ -114,16 +114,21 @@ class ComicExtra : ParsedHttpSource() {
return chapters return chapters
} }
val links = nav.getElementsByTag("a") val pg2url = nav.select("a:contains(next)").attr("href")
links.forEach { // recursively build the chapter list
if (it.text() != "Next") {
fetchChaptersFromNav(it.attr("href")).forEach { page -> fun parseChapters(nextURL: String) {
chapters.add(chapterFromElement(page)) 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 return chapters
} }