Izneo: fix missing chapters (#10711)
This commit is contained in:
parent
9f83a8a6ee
commit
54c55117c8
|
@ -6,7 +6,7 @@ ext {
|
||||||
extName = 'izneo (webtoons)'
|
extName = 'izneo (webtoons)'
|
||||||
pkgNameSuffix = 'all.izneo'
|
pkgNameSuffix = 'all.izneo'
|
||||||
extClass = '.IzneoFactory'
|
extClass = '.IzneoFactory'
|
||||||
extVersionCode = 2
|
extVersionCode = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
|
|
@ -21,6 +21,7 @@ import kotlinx.serialization.json.jsonArray
|
||||||
import kotlinx.serialization.json.jsonObject
|
import kotlinx.serialization.json.jsonObject
|
||||||
import kotlinx.serialization.json.jsonPrimitive
|
import kotlinx.serialization.json.jsonPrimitive
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
|
import rx.Observable
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
|
@ -77,9 +78,6 @@ class Izneo(override val lang: String) : ConfigurableSource, HttpSource() {
|
||||||
override fun mangaDetailsRequest(manga: SManga) =
|
override fun mangaDetailsRequest(manga: SManga) =
|
||||||
GET(ORIGIN + manga.url, headers)
|
GET(ORIGIN + manga.url, headers)
|
||||||
|
|
||||||
override fun chapterListRequest(manga: SManga) =
|
|
||||||
GET(manga.apiUrl + "/volumes/old/0/500", apiHeaders)
|
|
||||||
|
|
||||||
override fun pageListRequest(chapter: SChapter) =
|
override fun pageListRequest(chapter: SChapter) =
|
||||||
GET(ORIGIN + "/book/" + chapter.url, apiHeaders)
|
GET(ORIGIN + "/book/" + chapter.url, apiHeaders)
|
||||||
|
|
||||||
|
@ -138,7 +136,24 @@ class Izneo(override val lang: String) : ConfigurableSource, HttpSource() {
|
||||||
}!!
|
}!!
|
||||||
|
|
||||||
override fun fetchMangaDetails(manga: SManga) =
|
override fun fetchMangaDetails(manga: SManga) =
|
||||||
rx.Observable.just(manga.apply { initialized = true })!!
|
Observable.just(manga.apply { initialized = true })!!
|
||||||
|
|
||||||
|
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
|
||||||
|
val url = "$ORIGIN/$lang/api/web/serie/" +
|
||||||
|
manga.url.substringAfterLast('-') + "/volumes/old"
|
||||||
|
val chapters = mutableListOf<SChapter>()
|
||||||
|
var cutoff = 0
|
||||||
|
var current = LIMIT
|
||||||
|
while (current == LIMIT) {
|
||||||
|
client.newCall(GET("$url/$cutoff/$LIMIT", apiHeaders))
|
||||||
|
.execute().run(::chapterListParse).let {
|
||||||
|
cutoff += LIMIT
|
||||||
|
current = it.size
|
||||||
|
chapters.addAll(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Observable.just(chapters)
|
||||||
|
}
|
||||||
|
|
||||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||||
EditTextPreference(screen.context).apply {
|
EditTextPreference(screen.context).apply {
|
||||||
|
@ -164,9 +179,6 @@ class Izneo(override val lang: String) : ConfigurableSource, HttpSource() {
|
||||||
}.let(screen::addPreference)
|
}.let(screen::addPreference)
|
||||||
}
|
}
|
||||||
|
|
||||||
private inline val SManga.apiUrl: String
|
|
||||||
get() = "$ORIGIN/$lang/api/web/serie/" + url.substringAfterLast('-')
|
|
||||||
|
|
||||||
private inline val Album.timestamp: Long
|
private inline val Album.timestamp: Long
|
||||||
get() = dateFormat.parse(publicationDate)?.time ?: 0L
|
get() = dateFormat.parse(publicationDate)?.time ?: 0L
|
||||||
|
|
||||||
|
@ -182,6 +194,9 @@ class Izneo(override val lang: String) : ConfigurableSource, HttpSource() {
|
||||||
}
|
}
|
||||||
}.jsonObject
|
}.jsonObject
|
||||||
|
|
||||||
|
override fun chapterListRequest(manga: SManga) =
|
||||||
|
throw UnsupportedOperationException("Not used")
|
||||||
|
|
||||||
override fun mangaDetailsParse(response: Response) =
|
override fun mangaDetailsParse(response: Response) =
|
||||||
throw UnsupportedOperationException("Not used")
|
throw UnsupportedOperationException("Not used")
|
||||||
|
|
||||||
|
@ -191,6 +206,8 @@ class Izneo(override val lang: String) : ConfigurableSource, HttpSource() {
|
||||||
companion object {
|
companion object {
|
||||||
private const val ORIGIN = "https://izneo.com"
|
private const val ORIGIN = "https://izneo.com"
|
||||||
|
|
||||||
|
private const val LIMIT = 50
|
||||||
|
|
||||||
private val dateFormat by lazy {
|
private val dateFormat by lazy {
|
||||||
SimpleDateFormat("yyyy-MM-dd", Locale.ROOT)
|
SimpleDateFormat("yyyy-MM-dd", Locale.ROOT)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue