Dilbert fix (#1958)

Dilbert fix
This commit is contained in:
Mike 2020-01-03 07:18:28 -05:00 committed by arkon
parent 858447728d
commit 60c8d35bd7
2 changed files with 6 additions and 5 deletions

View File

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

View File

@ -11,6 +11,7 @@ import java.text.SimpleDateFormat
import java.util.Calendar
import java.util.Locale
import okhttp3.Headers
import okhttp3.OkHttpClient
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import rx.Observable
@ -25,7 +26,7 @@ class Dilbert : ParsedHttpSource() {
override val supportsLatest = false
override val client = network.client.newBuilder()
override val client: OkHttpClient = network.client.newBuilder()
.addNetworkInterceptor(RateLimitInterceptor(4)).build()
private val userAgent = "Mozilla/5.0 " +
@ -59,7 +60,7 @@ class Dilbert : ParsedHttpSource() {
override fun fetchSearchManga(page: Int, query: String, filters: FilterList) = fetchPopularManga(page)
override fun fetchMangaDetails(manga: SManga) =
override fun fetchMangaDetails(manga: SManga): Observable<SManga> =
Observable.just(manga.apply { initialized = true })
private fun chapterListRequest(manga: SManga, page: Int = 1) =
@ -84,8 +85,8 @@ class Dilbert : ParsedHttpSource() {
chapters.addAll(it.select(".comic-item").map(::chapterFromElement))
}
}
val pages = getChapters().first(".pagination > li:nth-last-child(2) > a").text().toInt()
for (page in 2..pages) getChapters(page)
val pages = getChapters().first(".pagination > li:nth-last-child(2) > a")?.text()?.toIntOrNull()
if (pages != null) for (page in 2..pages) getChapters(page)
return Observable.just(
chapters.sortedBy(SChapter::date_upload).mapIndexed {
i, ch -> ch.apply { chapter_number = i + 1f }