NineHentai: fix galleries with broken last page (#5841)

This commit is contained in:
scb261 2021-02-14 16:22:09 +02:00 committed by GitHub
parent 3eed4041cb
commit eeb2f25e9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'NineHentai'
pkgNameSuffix = 'all.ninehentai'
extClass = '.NineHentai'
extVersionCode = 8
extVersionCode = 9
libVersion = '1.2'
containsNsfw = true
}

View File

@ -8,6 +8,7 @@ import com.google.gson.Gson
import com.google.gson.JsonElement
import com.google.gson.JsonParser
import eu.kanade.tachiyomi.annotations.Nsfw
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.POST
import eu.kanade.tachiyomi.network.asObservableSuccess
import eu.kanade.tachiyomi.source.model.Filter
@ -162,6 +163,15 @@ class NineHentai : HttpSource() {
}
val pages = mutableListOf<Page>()
client.newCall(
GET(
"$imageUrl/preview/${totalPages}t.jpg",
headersBuilder().build()
)
).execute().code().let { code ->
if (code == 404) totalPages--
}
for (i in 1..totalPages) {
pages.add(Page(pages.size, "", "$imageUrl/$i.jpg"))
}