KSGroupScans: Don't assign date_upload to chapters (#13669)

* KSGroupScans: Don't assign uploadDate to chapters

Date related stuff is highly broken in the site. Chapters from 2~3 months ago appear as 1 years ago

* Cleanup FMReaderGenerator

* Fix import
This commit is contained in:
AntsyLich 2022-10-01 18:03:45 +06:00 committed by GitHub
parent 765647cf5f
commit 16d4610115
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 61 deletions

View File

@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.extension.en.ksgroupscans
import eu.kanade.tachiyomi.multisrc.fmreader.FMReader
import eu.kanade.tachiyomi.source.model.SChapter
import org.jsoup.nodes.Element
import java.util.Calendar
class KSGroupScans : FMReader("KSGroupScans", "https://ksgroupscans.com", "en") {
override fun popularMangaNextPageSelector() = ".pagination > li:last-child > a:not(.active)"
@ -14,55 +13,6 @@ class KSGroupScans : FMReader("KSGroupScans", "https://ksgroupscans.com", "en")
setUrlWithoutDomain(it.attr("abs:href"))
name = element.select(".chapter-name").text()
}
date_upload = element.select(chapterTimeSelector).let { if (it.hasText()) parseChapterDate(it.text()) else 0 }
}
}
private fun parseChapterDate(date: String): Long {
val value = date.split(' ')[dateValueIndex].toInt()
val dateWord = date.split(' ')[dateWordIndex].let {
if (it.contains("(")) {
it.substringBefore("(")
} else {
it.substringBefore("s")
}
}
// languages: en, vi, es, tr
return when (dateWord) {
"min", "minute", "phút", "minuto", "dakika" -> Calendar.getInstance().apply {
add(Calendar.MINUTE, value * -1)
set(Calendar.SECOND, 0)
set(Calendar.MILLISECOND, 0)
}.timeInMillis
"hour", "giờ", "hora", "saat" -> Calendar.getInstance().apply {
add(Calendar.HOUR_OF_DAY, value * -1)
set(Calendar.SECOND, 0)
set(Calendar.MILLISECOND, 0)
}.timeInMillis
"day", "ngày", "día", "gün" -> Calendar.getInstance().apply {
add(Calendar.DATE, value * -1)
set(Calendar.SECOND, 0)
set(Calendar.MILLISECOND, 0)
}.timeInMillis
"week", "tuần", "semana", "hafta" -> Calendar.getInstance().apply {
add(Calendar.DATE, value * 7 * -1)
set(Calendar.SECOND, 0)
set(Calendar.MILLISECOND, 0)
}.timeInMillis
"month", "tháng", "mes", "ay" -> Calendar.getInstance().apply {
add(Calendar.MONTH, value * -1)
set(Calendar.SECOND, 0)
set(Calendar.MILLISECOND, 0)
}.timeInMillis
"year", "năm", "año", "yıl" -> Calendar.getInstance().apply {
add(Calendar.YEAR, value * -1)
set(Calendar.SECOND, 0)
set(Calendar.MILLISECOND, 0)
}.timeInMillis
else -> {
return 0
}
}
}
}

View File

@ -12,22 +12,16 @@ class FMReaderGenerator : ThemeSourceGenerator {
override val baseVersionCode: Int = 7
/** For future sources: when testing and popularMangaRequest() returns a Jsoup error instead of results
* most likely the fix is to override popularMangaNextPageSelector() */
override val sources = listOf(
MultiLang("Manhwa18.net", "https://manhwa18.net", listOf("en", "ko"), className = "Manhwa18NetFactory", isNsfw = true),
SingleLang("Epik Manga", "https://www.epikmanga.com", "tr"),
SingleLang("KissLove", "https://klmanga.com", "ja", overrideVersionCode = 2),
SingleLang("KSGroupScans", "https://ksgroupscans.com", "en", overrideVersionCode = 2),
SingleLang("Manga-TR", "https://manga-tr.com", "tr", className = "MangaTR", overrideVersionCode = 1),
SingleLang("Manhwa18", "https://manhwa18.com", "en", isNsfw = true, overrideVersionCode = 2),
MultiLang("Manhwa18.net", "https://manhwa18.net", listOf("en", "ko"), className = "Manhwa18NetFactory", isNsfw = true),
SingleLang("WeLoveManga", "https://weloma.art", "ja", pkgName = "rawlh", overrideVersionCode = 4),
SingleLang("Say Truyen", "https://saytruyen.net", "vi", overrideVersionCode = 2),
SingleLang("ManhuaRock", "https://manhuarock.net", "vi", overrideVersionCode = 1),
SingleLang("KSGroupScans", "https://ksgroupscans.com", "en", overrideVersionCode = 1),
// Sites that went down
// SingleLang("18LHPlus", "https://18lhplus.com", "en", className = "EighteenLHPlus"),
// SingleLang("HanaScan (RawQQ)", "https://hanascan.com", "ja", className = "HanaScanRawQQ"),
SingleLang("Manhwa18", "https://manhwa18.com", "en", isNsfw = true, overrideVersionCode = 2),
SingleLang("Say Truyen", "https://saytruyen.net", "vi", overrideVersionCode = 2),
SingleLang("WeLoveManga", "https://weloma.art", "ja", pkgName = "rawlh", overrideVersionCode = 4),
)
companion object {