Fix henchan.pro single chapters mangas (#4258)
Co-authored-by: pavkazzz <me@pavkazzz.ru>
This commit is contained in:
parent
29c3798c2a
commit
e51b2a7b3a
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'Henchan'
|
extName = 'Henchan'
|
||||||
pkgNameSuffix = 'ru.henchan'
|
pkgNameSuffix = 'ru.henchan'
|
||||||
extClass = '.Henchan'
|
extClass = '.Henchan'
|
||||||
extVersionCode = 17
|
extVersionCode = 18
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
containsNsfw = true
|
containsNsfw = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import com.google.gson.JsonObject
|
||||||
import eu.kanade.tachiyomi.annotations.Nsfw
|
import eu.kanade.tachiyomi.annotations.Nsfw
|
||||||
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
|
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
|
import eu.kanade.tachiyomi.network.asObservable
|
||||||
import eu.kanade.tachiyomi.source.model.Filter
|
import eu.kanade.tachiyomi.source.model.Filter
|
||||||
import eu.kanade.tachiyomi.source.model.FilterList
|
import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
import eu.kanade.tachiyomi.source.model.Page
|
import eu.kanade.tachiyomi.source.model.Page
|
||||||
|
@ -27,6 +28,7 @@ import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
|
import rx.Observable
|
||||||
|
|
||||||
@Nsfw
|
@Nsfw
|
||||||
class Henchan : ParsedHttpSource() {
|
class Henchan : ParsedHttpSource() {
|
||||||
|
@ -140,6 +142,26 @@ class Henchan : ParsedHttpSource() {
|
||||||
return manga
|
return manga
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
|
||||||
|
return client.newCall(chapterListRequest(manga))
|
||||||
|
.asObservable().doOnNext { response ->
|
||||||
|
if (!response.isSuccessful) {
|
||||||
|
response.close()
|
||||||
|
// Error message for exceeding last page
|
||||||
|
if (response.code() == 404)
|
||||||
|
Observable.just(listOf(SChapter.create().apply {
|
||||||
|
url = manga.url
|
||||||
|
name = "Chapter"
|
||||||
|
chapter_number = 1f
|
||||||
|
}))
|
||||||
|
else throw Exception("HTTP error ${response.code()}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.map { response ->
|
||||||
|
chapterListParse(response)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun chapterListRequest(manga: SManga): Request {
|
override fun chapterListRequest(manga: SManga): Request {
|
||||||
val url = baseUrl + if (manga.thumbnail_url?.endsWith("#") == true) {
|
val url = baseUrl + if (manga.thumbnail_url?.endsWith("#") == true) {
|
||||||
manga.url
|
manga.url
|
||||||
|
|
Loading…
Reference in New Issue