MyHentaiComics - fix pages (#3525)

This commit is contained in:
Mike 2020-06-13 23:17:34 -04:00 committed by GitHub
parent ca55416443
commit 505e954175
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: MyHentaiComics'
pkgNameSuffix = 'en.myhentaicomics'
extClass = '.MyHentaiComics'
extVersionCode = 1
extVersionCode = 2
libVersion = '1.2'
}

View File

@ -7,6 +7,7 @@ import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.OkHttpClient
import okhttp3.Request
import org.jsoup.nodes.Document
@ -117,9 +118,20 @@ class MyHentaiComics : ParsedHttpSource() {
// Pages
override fun pageListParse(document: Document): List<Page> {
return document.select("img.g-thumbnail").mapIndexed { i, img ->
Page(i, "", img.attr("abs:src").replace("/thumbs/", "/resizes/"))
val pages = mutableListOf<Page>()
// recursively parse paginated pages
fun parsePage(document: Document) {
document.select("img.g-thumbnail").map { img ->
pages.add(Page(pages.size, "", img.attr("abs:src").replace("/thumbs/", "/resizes/")))
}
document.select("ul.g-paginator a.ui-state-default:contains(Next)").firstOrNull()?.let { a ->
parsePage(client.newCall(GET(a.attr("abs:href"), headers)).execute().asJsoup())
}
}
parsePage(document)
return pages
}
override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used")