diff --git a/src/en/tcbscans/build.gradle b/src/en/tcbscans/build.gradle index 1e1028d38..20b9dd75c 100644 --- a/src/en/tcbscans/build.gradle +++ b/src/en/tcbscans/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'TCB Scans' pkgNameSuffix = 'en.tcbscans' extClass = '.TCBScans' - extVersionCode = 1 + extVersionCode = 2 libVersion = '1.2' } diff --git a/src/en/tcbscans/src/eu/kanade/tachiyomi/extension/en/tcbscans/TCBScans.kt b/src/en/tcbscans/src/eu/kanade/tachiyomi/extension/en/tcbscans/TCBScans.kt index 2e188ea24..4da4260e0 100644 --- a/src/en/tcbscans/src/eu/kanade/tachiyomi/extension/en/tcbscans/TCBScans.kt +++ b/src/en/tcbscans/src/eu/kanade/tachiyomi/extension/en/tcbscans/TCBScans.kt @@ -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 { + 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 { val pages = mutableListOf()