Colamanga: add upload date to latest chapter (#7935)
* ColaMange: Update filter * ColaMange: add date_upload The mange chapter should used the last updated date as the date_upload for user to better predict the next new chapters date * ColaMange: Improve date parse * Revert bump * ColoManga: minor update * ColoManga: bump * ColoManga: add error check --------- Co-authored-by: AwkwardPeak7 <48650614+AwkwardPeak7@users.noreply.github.com>
This commit is contained in:
parent
d58a274c70
commit
c986f2924c
@ -2,7 +2,7 @@ plugins {
|
|||||||
id("lib-multisrc")
|
id("lib-multisrc")
|
||||||
}
|
}
|
||||||
|
|
||||||
baseVersionCode = 8
|
baseVersionCode = 9
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api(project(":lib:synchrony"))
|
api(project(":lib:synchrony"))
|
||||||
|
@ -19,19 +19,23 @@ import eu.kanade.tachiyomi.source.model.Page
|
|||||||
import eu.kanade.tachiyomi.source.model.SChapter
|
import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
||||||
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
import keiyoushi.utils.getPreferencesLazy
|
import keiyoushi.utils.getPreferencesLazy
|
||||||
|
import keiyoushi.utils.tryParse
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import kotlinx.serialization.json.jsonArray
|
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.HttpUrl.Companion.toHttpUrl
|
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
|
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
|
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 uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
import java.util.concurrent.CountDownLatch
|
import java.util.concurrent.CountDownLatch
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
@ -149,6 +153,8 @@ abstract class ColaManga(
|
|||||||
protected abstract val genreTitle: String
|
protected abstract val genreTitle: String
|
||||||
protected abstract val statusOngoing: String
|
protected abstract val statusOngoing: String
|
||||||
protected abstract val statusCompleted: String
|
protected abstract val statusCompleted: String
|
||||||
|
protected abstract val lastUpdated: String
|
||||||
|
private val dateFormat: SimpleDateFormat = SimpleDateFormat("yyyy-MM-dd")
|
||||||
|
|
||||||
override fun mangaDetailsParse(document: Document) = SManga.create().apply {
|
override fun mangaDetailsParse(document: Document) = SManga.create().apply {
|
||||||
title = document.selectFirst("h1.fed-part-eone")!!.text()
|
title = document.selectFirst("h1.fed-part-eone")!!.text()
|
||||||
@ -167,6 +173,15 @@ abstract class ColaManga(
|
|||||||
|
|
||||||
override fun chapterListSelector(): String = "div:not(.fed-hidden) > div.all_data_list > ul.fed-part-rows a"
|
override fun chapterListSelector(): String = "div:not(.fed-hidden) > div.all_data_list > ul.fed-part-rows a"
|
||||||
|
|
||||||
|
override fun chapterListParse(response: Response): List<SChapter> {
|
||||||
|
val document = response.asJsoup()
|
||||||
|
return document.select(chapterListSelector()).map { chapterFromElement(it) }.apply {
|
||||||
|
if (isNotEmpty()) {
|
||||||
|
this[0].date_upload = dateFormat.tryParse(document.selectFirst("span.fed-text-muted:contains($lastUpdated) + a")?.text())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun chapterFromElement(element: Element) = SChapter.create().apply {
|
override fun chapterFromElement(element: Element) = SChapter.create().apply {
|
||||||
setUrlWithoutDomain(element.attr("href"))
|
setUrlWithoutDomain(element.attr("href"))
|
||||||
name = element.attr("title")
|
name = element.attr("title")
|
||||||
|
@ -14,6 +14,7 @@ class Onemanhua : ColaManga("COLAMANGA", "https://www.colamanga.com", "zh") {
|
|||||||
override val genreTitle = "类别"
|
override val genreTitle = "类别"
|
||||||
override val statusOngoing = "连载中"
|
override val statusOngoing = "连载中"
|
||||||
override val statusCompleted = "已完结"
|
override val statusCompleted = "已完结"
|
||||||
|
override val lastUpdated = "更新"
|
||||||
|
|
||||||
override fun getFilterList(): FilterList {
|
override fun getFilterList(): FilterList {
|
||||||
val filters = buildList {
|
val filters = buildList {
|
||||||
@ -82,6 +83,7 @@ class Onemanhua : ColaManga("COLAMANGA", "https://www.colamanga.com", "zh") {
|
|||||||
Pair("霸总", "10127"),
|
Pair("霸总", "10127"),
|
||||||
Pair("大女主", "10706"),
|
Pair("大女主", "10706"),
|
||||||
Pair("生活", "10142"),
|
Pair("生活", "10142"),
|
||||||
|
Pair("少年热血", "12163"),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
private class CharFilter : UriPartFilter(
|
private class CharFilter : UriPartFilter(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user