Add support for determining series type (#10985)

This commit is contained in:
h-hyuuga 2022-03-02 04:46:12 -05:00 committed by GitHub
parent 6c512e4caf
commit 581f64ace0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 7 deletions

View File

@ -96,14 +96,17 @@ open class Genkan(
.let { if (it.startsWith("http")) it else baseUrl + it }
}
override fun mangaDetailsParse(document: Document): SManga {
return SManga.create().apply {
title = document.select("div#content h5").first().text()
description = document.select("div.col-lg-9").text().substringAfter("Description ").substringBefore(" Volume")
thumbnail_url = styleToUrl(document.select("div.media a").first())
}
protected var countryOfOriginSelector = ".card.mt-2 .list-item:contains(Country of Origin) .no-wrap"
override fun mangaDetailsParse(document: Document) = SManga.create().apply {
title = document.select("div#content h5").first().text()
description = document.select("div.col-lg-9").text().substringAfter("Description ").substringBefore(" Volume")
thumbnail_url = styleToUrl(document.select("div.media a").first())
genre = listOfNotNull(
document.selectFirst(countryOfOriginSelector)?.let { countryOfOriginToSeriesType(it.text())}
).joinToString()
}
override fun chapterListSelector() = "div.col-lg-9 div.flex"
override fun chapterFromElement(element: Element): SChapter {
@ -137,6 +140,13 @@ open class Genkan(
}
}
private fun countryOfOriginToSeriesType(country: String) = when (country) {
"South Korea" -> "Manhwa"
"Japan" -> "Manga"
"China" -> "Manhua"
else -> null
}
// Subtract relative date (e.g. posted 3 days ago)
private fun parseRelativeDate(date: String): Long? {
val trimmedDate = date.substringBefore(" ago").removeSuffix("s").split(" ")

View File

@ -9,7 +9,7 @@ class GenkanGenerator : ThemeSourceGenerator {
override val themeClass = "Genkan"
override val baseVersionCode: Int = 2
override val baseVersionCode: Int = 3
override val sources = listOf(
SingleLang("Hunlight Scans", "https://hunlight-scans.info", "en"),