TCBScans: filter out latest chapter if it's not released yet (#6050)
This commit is contained in:
parent
12d2f44c56
commit
f65bda82c4
|
@ -5,7 +5,7 @@ ext {
|
|||
extName = 'TCB Scans'
|
||||
pkgNameSuffix = 'en.tcbscans'
|
||||
extClass = '.TCBScans'
|
||||
extVersionCode = 1
|
||||
extVersionCode = 2
|
||||
libVersion = '1.2'
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,10 @@ 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 okhttp3.Response
|
||||
import org.jsoup.nodes.Document
|
||||
import org.jsoup.nodes.Element
|
||||
import java.util.Calendar
|
||||
|
@ -112,6 +114,29 @@ class TCBScans : ParsedHttpSource() {
|
|||
return 0L
|
||||
}
|
||||
|
||||
override fun chapterListParse(response: Response): List<SChapter> {
|
||||
val document = response.asJsoup()
|
||||
val chapterList = document.select(chapterListSelector()).map { chapterFromElement(it) }
|
||||
|
||||
return if (hasCountdown(chapterList[0]))
|
||||
chapterList.subList(1, chapterList.size)
|
||||
else
|
||||
chapterList
|
||||
}
|
||||
|
||||
private fun hasCountdown(chapter: SChapter): Boolean {
|
||||
val document = client.newCall(
|
||||
GET(
|
||||
baseUrl + chapter.url,
|
||||
headersBuilder().build()
|
||||
)
|
||||
).execute().asJsoup()
|
||||
|
||||
return document
|
||||
.select("iframe[src^=https://free.timeanddate.com/countdown/]")
|
||||
.isNotEmpty()
|
||||
}
|
||||
|
||||
// pages
|
||||
override fun pageListParse(document: Document): List<Page> {
|
||||
val pages = mutableListOf<Page>()
|
||||
|
|
Loading…
Reference in New Issue