Madara: Val for Manga Details Selector; Leviatan Scans: fix manga description (#9735)
* Val for Manga Details Selector for simpler fix to change some selector * Fix leviatan scans manga description
This commit is contained in:
parent
f7620bc174
commit
87c37610d1
|
@ -27,6 +27,8 @@ class LeviatanScansEN : Madara("Leviatan Scans", "https://leviatanscans.com", "e
|
||||||
|
|
||||||
override fun chapterFromElement(element: Element) =
|
override fun chapterFromElement(element: Element) =
|
||||||
replaceRandomUrlPartInChapter(super.chapterFromElement(element))
|
replaceRandomUrlPartInChapter(super.chapterFromElement(element))
|
||||||
|
|
||||||
|
override val mangaDetailsSelectorDescription = "div.post-content div.manga-excerpt"
|
||||||
}
|
}
|
||||||
class LeviatanScansES : Madara("Leviatan Scans", "https://es.leviatanscans.com", "es") {
|
class LeviatanScansES : Madara("Leviatan Scans", "https://es.leviatanscans.com", "es") {
|
||||||
override val useNewChapterEndpoint: Boolean = true
|
override val useNewChapterEndpoint: Boolean = true
|
||||||
|
|
|
@ -319,20 +319,20 @@ abstract class Madara(
|
||||||
override fun mangaDetailsParse(document: Document): SManga {
|
override fun mangaDetailsParse(document: Document): SManga {
|
||||||
val manga = SManga.create()
|
val manga = SManga.create()
|
||||||
with(document) {
|
with(document) {
|
||||||
select("div.post-title h3").first()?.let {
|
select(mangaDetailsSelectorTitle).first()?.let {
|
||||||
manga.title = it.ownText()
|
manga.title = it.ownText()
|
||||||
}
|
}
|
||||||
select("div.author-content > a").eachText().filter {
|
select(mangaDetailsSelectorAuthor).eachText().filter {
|
||||||
it.notUpdating()
|
it.notUpdating()
|
||||||
}.joinToString().takeIf { it.isNotBlank() }?.let {
|
}.joinToString().takeIf { it.isNotBlank() }?.let {
|
||||||
manga.author = it
|
manga.author = it
|
||||||
}
|
}
|
||||||
select("div.artist-content > a").eachText().filter {
|
select(mangaDetailsSelectorArtist).eachText().filter {
|
||||||
it.notUpdating()
|
it.notUpdating()
|
||||||
}.joinToString().takeIf { it.isNotBlank() }?.let {
|
}.joinToString().takeIf { it.isNotBlank() }?.let {
|
||||||
manga.artist = it
|
manga.artist = it
|
||||||
}
|
}
|
||||||
select("div.description-summary div.summary__content").let {
|
select(mangaDetailsSelectorDescription).let {
|
||||||
if (it.select("p").text().isNotEmpty()) {
|
if (it.select("p").text().isNotEmpty()) {
|
||||||
manga.description = it.select("p").joinToString(separator = "\n\n") { p ->
|
manga.description = it.select("p").joinToString(separator = "\n\n") { p ->
|
||||||
p.text().replace("<br>", "\n")
|
p.text().replace("<br>", "\n")
|
||||||
|
@ -341,10 +341,10 @@ abstract class Madara(
|
||||||
manga.description = it.text()
|
manga.description = it.text()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
select("div.summary_image img").first()?.let {
|
select(mangaDetailsSelectorThumbnail).first()?.let {
|
||||||
manga.thumbnail_url = imageFromElement(it)
|
manga.thumbnail_url = imageFromElement(it)
|
||||||
}
|
}
|
||||||
select("div.summary-content").last()?.let {
|
select(mangaDetailsSelectorStatus).last()?.let {
|
||||||
manga.status = when (it.text()) {
|
manga.status = when (it.text()) {
|
||||||
// I don't know what's the corresponding for COMPLETED and LICENSED
|
// I don't know what's the corresponding for COMPLETED and LICENSED
|
||||||
// There's no support for "Canceled" or "On Hold"
|
// There's no support for "Canceled" or "On Hold"
|
||||||
|
@ -353,12 +353,12 @@ abstract class Madara(
|
||||||
else -> SManga.UNKNOWN
|
else -> SManga.UNKNOWN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val genres = select("div.genres-content a")
|
val genres = select(mangaDetailsSelectorGenre)
|
||||||
.map { element -> element.text().toLowerCase(Locale.ROOT) }
|
.map { element -> element.text().toLowerCase(Locale.ROOT) }
|
||||||
.toMutableSet()
|
.toMutableSet()
|
||||||
|
|
||||||
// add tag(s) to genre
|
// add tag(s) to genre
|
||||||
select("div.tags-content a").forEach { element ->
|
select(mangaDetailsSelectorTag).forEach { element ->
|
||||||
if (genres.contains(element.text()).not()) {
|
if (genres.contains(element.text()).not()) {
|
||||||
genres.add(element.text().toLowerCase(Locale.ROOT))
|
genres.add(element.text().toLowerCase(Locale.ROOT))
|
||||||
}
|
}
|
||||||
|
@ -387,6 +387,16 @@ abstract class Madara(
|
||||||
return manga
|
return manga
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Manga Details Selector
|
||||||
|
open val mangaDetailsSelectorTitle = "div.post-title h3"
|
||||||
|
open val mangaDetailsSelectorAuthor = "div.author-content > a"
|
||||||
|
open val mangaDetailsSelectorArtist = "div.artist-content > a"
|
||||||
|
open val mangaDetailsSelectorStatus = "div.summary-content"
|
||||||
|
open val mangaDetailsSelectorDescription = "div.description-summary div.summary__content"
|
||||||
|
open val mangaDetailsSelectorThumbnail = "div.summary_image img"
|
||||||
|
open val mangaDetailsSelectorGenre = "div.genres-content a"
|
||||||
|
open val mangaDetailsSelectorTag = "div.tags-content a"
|
||||||
|
|
||||||
open val seriesTypeSelector = ".post-content_item:contains(Type) .summary-content"
|
open val seriesTypeSelector = ".post-content_item:contains(Type) .summary-content"
|
||||||
open val altNameSelector = ".post-content_item:contains(Alt) .summary-content"
|
open val altNameSelector = ".post-content_item:contains(Alt) .summary-content"
|
||||||
open val altName = "Alternative Name" + ": "
|
open val altName = "Alternative Name" + ": "
|
||||||
|
|
|
@ -13,7 +13,7 @@ class MadaraGenerator : ThemeSourceGenerator {
|
||||||
override val baseVersionCode: Int = 11
|
override val baseVersionCode: Int = 11
|
||||||
|
|
||||||
override val sources = listOf(
|
override val sources = listOf(
|
||||||
MultiLang("Leviatan Scans", "https://leviatanscans.com", listOf("en", "es"), className = "LeviatanScansFactory", overrideVersionCode = 8),
|
MultiLang("Leviatan Scans", "https://leviatanscans.com", listOf("en", "es"), className = "LeviatanScansFactory", overrideVersionCode = 9),
|
||||||
MultiLang("MangaForFree.net", "https://mangaforfree.net", listOf("en", "ko", "all"), isNsfw = true, className = "MangaForFreeFactory", pkgName = "mangaforfree", overrideVersionCode = 1),
|
MultiLang("MangaForFree.net", "https://mangaforfree.net", listOf("en", "ko", "all"), isNsfw = true, className = "MangaForFreeFactory", pkgName = "mangaforfree", overrideVersionCode = 1),
|
||||||
MultiLang("Manhwa18.cc", "https://manhwa18.cc", listOf("en", "ko", "all"), isNsfw = true, className = "Manhwa18CcFactory", pkgName = "manhwa18cc"),
|
MultiLang("Manhwa18.cc", "https://manhwa18.cc", listOf("en", "ko", "all"), isNsfw = true, className = "Manhwa18CcFactory", pkgName = "manhwa18cc"),
|
||||||
MultiLang("Reaper Scans", "https://reaperscans.com", listOf("en", "pt-BR"), className = "ReaperScansFactory", pkgName = "reaperscans", overrideVersionCode = 2),
|
MultiLang("Reaper Scans", "https://reaperscans.com", listOf("en", "pt-BR"), className = "ReaperScansFactory", pkgName = "reaperscans", overrideVersionCode = 2),
|
||||||
|
|
Loading…
Reference in New Issue