Override manga details parsing (#8493)

This commit is contained in:
Arraiment 2021-08-09 20:50:05 +08:00 committed by GitHub
parent 98a385ca5d
commit 76ff5c9090
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 50 additions and 1 deletions

View File

@ -0,0 +1,49 @@
package eu.kanade.tachiyomi.extension.en.manhwanelo
import eu.kanade.tachiyomi.multisrc.madara.Madara
import eu.kanade.tachiyomi.source.model.SManga
import org.jsoup.nodes.Document
import java.util.Locale
class ManhwaNelo : Madara("ManhwaNelo", "https://manhwanelo.com", "en") {
override fun mangaDetailsParse(document: Document): SManga {
val manga = SManga.create()
with(document) {
select("div.detailsingle h1").first()?.let {
manga.title = it.ownText()
}
select("div.author a").eachText().filter {
it.notUpdating()
}.joinToString().takeIf { it.isNotBlank() }?.let {
manga.author = it
// Site does not separate artist and author
manga.artist = manga.author
}
select("div.description-summary div.summary__content").let {
if (it.select("p").text().isNotEmpty()) {
manga.description = it.select("p").joinToString(separator = "\n\n") { p ->
p.text().replace("<br>", "\n")
}
} else {
manga.description = it.text()
}
}
select("div.summary_image img").first()?.let {
manga.thumbnail_url = imageFromElement(it)
}
select("div.status p").let {
manga.status = when (it.text().substringAfter("| ")) {
"end" -> SManga.COMPLETED
"on-going" -> SManga.ONGOING
else -> SManga.UNKNOWN
}
}
manga.genre = select("div.genres a")
.joinToString(", ") { element -> element.text().toLowerCase(Locale.ROOT) }
return manga
}
}
}

View File

@ -256,7 +256,7 @@ class MadaraGenerator : ThemeSourceGenerator {
SingleLang("Manhwa.biz", "https://manhwa.biz", "en", isNsfw = true, className = "Manhwabiz"),
SingleLang("ManhwaBookShelf", "https://manhwabookshelf.com", "en"),
SingleLang("Manhwafull", "https://manhwafull.com", "en"),
SingleLang("ManhwaNelo", "https://manhwanelo.com", "en"),
SingleLang("ManhwaNelo", "https://manhwanelo.com", "en", overrideVersionCode = 1),
SingleLang("ManhwaPool", "https://manhwapool.com", "en"),
SingleLang("Manhwatop", "https://manhwatop.com", "en", overrideVersionCode = 1),
SingleLang("Manhwahentai.me", "https://manhwahentai.me", "en", className = "ManhwahentaiMe", isNsfw = true, overrideVersionCode = 1),