Bato.to description: add extra info, format alternative titles (#7171)
CI / Prepare job (push) Successful in 4s Details
CI / Build individual modules (push) Successful in 7m23s Details
CI / Publish repo (push) Successful in 44s Details

* Bato.to: add extra info in description

* Bato.to: format alt titles
This commit is contained in:
Vetle Ledaal 2025-01-17 16:33:41 +01:00 committed by Draff
parent 924e064e42
commit 988d1b04af
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
2 changed files with 17 additions and 7 deletions

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'Bato.to' extName = 'Bato.to'
extClass = '.BatoToFactory' extClass = '.BatoToFactory'
extVersionCode = 45 extVersionCode = 46
isNsfw = true isNsfw = true
} }

View File

@ -335,14 +335,25 @@ open class BatoTo(
Regex("\\([^()]*\\)|\\{[^{}]*\\}|\\[(?:(?!]).)*]|«[^»]*»|〘[^〙]*〙|「[^」]*」|『[^』]*』|≪[^≫]*≫|﹛[^﹜]*﹜|〖[^〖〗]*〗|𖤍.+?𖤍|《[^》]*》|⌜.+?⌝|⟨[^⟩]*⟩|\\/Official|\\/ Official", RegexOption.IGNORE_CASE) Regex("\\([^()]*\\)|\\{[^{}]*\\}|\\[(?:(?!]).)*]|«[^»]*»|〘[^〙]*〙|「[^」]*」|『[^』]*』|≪[^≫]*≫|﹛[^﹜]*﹜|〖[^〖〗]*〗|𖤍.+?𖤍|《[^》]*》|⌜.+?⌝|⟨[^⟩]*⟩|\\/Official|\\/ Official", RegexOption.IGNORE_CASE)
override fun mangaDetailsParse(document: Document): SManga { override fun mangaDetailsParse(document: Document): SManga {
val infoElement = document.select("div#mainer div.container-fluid") val infoElement = document.selectFirst("div#mainer div.container-fluid")!!
val manga = SManga.create() val manga = SManga.create()
val workStatus = infoElement.select("div.attr-item:contains(original work) span").text() val workStatus = infoElement.select("div.attr-item:contains(original work) span").text()
val uploadStatus = infoElement.select("div.attr-item:contains(upload status) span").text() val uploadStatus = infoElement.select("div.attr-item:contains(upload status) span").text()
val originalTitle = infoElement.select("h3").text().removeEntities() val originalTitle = infoElement.select("h3").text().removeEntities()
val alternativeTitles = document.select("div.pb-2.alias-set.line-b-f").text() val description = buildString {
val description = infoElement.select("div.limit-html").text() + "\n" + append(infoElement.select("div.limit-html").text())
infoElement.select(".episode-list > .alert-warning").text().trim() infoElement.selectFirst(".episode-list > .alert-warning")?.also {
append("\n\n${it.text()}")
}
infoElement.selectFirst("h5:containsOwn(Extra Info:) + div")?.also {
append("\n\nExtra Info:\n${it.text()}")
}
document.selectFirst("div.pb-2.alias-set.line-b-f")?.also {
append("\n\nAlternative Titles:\n")
append(it.text().split('/').joinToString("\n") { "${it.trim()}" })
}
}
val cleanedTitle = if (isRemoveTitleVersion()) { val cleanedTitle = if (isRemoveTitleVersion()) {
originalTitle.replace(titleRegex, "").trim() originalTitle.replace(titleRegex, "").trim()
} else { } else {
@ -354,8 +365,7 @@ open class BatoTo(
manga.artist = infoElement.select("div.attr-item:contains(artist) span").text() manga.artist = infoElement.select("div.attr-item:contains(artist) span").text()
manga.status = parseStatus(workStatus, uploadStatus) manga.status = parseStatus(workStatus, uploadStatus)
manga.genre = infoElement.select(".attr-item b:contains(genres) + span ").joinToString { it.text() } manga.genre = infoElement.select(".attr-item b:contains(genres) + span ").joinToString { it.text() }
manga.description = description + manga.description = description
if (alternativeTitles.isNotBlank()) "\n\nAlternative Titles:\n$alternativeTitles" else ""
manga.thumbnail_url = document.select("div.attr-cover img").attr("abs:src") manga.thumbnail_url = document.select("div.attr-cover img").attr("abs:src")
return manga return manga
} }