TeamX fix NextPage chapter list (#4866)

other page chapter list not listed
This commit is contained in:
Riztard Lanthorn 2020-11-13 22:43:35 +07:00 committed by GitHub
parent 15f38383b3
commit 19839e5188
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 1 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Team X'
pkgNameSuffix = 'ar.teamx'
extClass = '.TeamX'
extVersionCode = 8
extVersionCode = 9
libVersion = '1.2'
}

View File

@ -117,6 +117,29 @@ class TeamX : ParsedHttpSource() {
}
// Chapters
private fun chapterNextPageSelector() = "span.nextx_text a:contains(»)"
override fun chapterListParse(response: Response): List<SChapter> {
val allChapters = mutableListOf<SChapter>()
var document = response.asJsoup()
while (true) {
val pageChapters = document.select(chapterListSelector()).map { chapterFromElement(it) }
if (pageChapters.isEmpty())
break
allChapters += pageChapters
val hasNextPage = document.select(chapterNextPageSelector()).isNotEmpty()
if (!hasNextPage)
break
val nextUrl = document.select(chapterNextPageSelector()).attr("href")
document = client.newCall(GET(nextUrl, headers)).execute().asJsoup()
}
return allChapters
}
// Filter out the fake chapters
override fun chapterListSelector() = "div.single-manga-chapter div.col-md-12 a[href^=$baseUrl]"