Batoto: Fix extra info + Hide empty alt titles + Fall back to upload status (#7312)

Fix extra info + Hide empty alt titles + Fall back to upload status
This commit is contained in:
DokterKaj 2025-01-26 20:45:09 +08:00 committed by Draff
parent b0eda7b44d
commit 944586408e
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
2 changed files with 15 additions and 12 deletions

View File

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

View File

@ -346,9 +346,9 @@ open class BatoTo(
append("\n\n${it.text()}")
}
infoElement.selectFirst("h5:containsOwn(Extra Info:) + div")?.also {
append("\n\nExtra Info:\n${it.text()}")
append("\n\nExtra Info:\n${it.wholeText()}")
}
document.selectFirst("div.pb-2.alias-set.line-b-f")?.also {
document.selectFirst("div.pb-2.alias-set.line-b-f")?.takeIf { it.hasText() }?.also {
append("\n\nAlternative Titles:\n")
append(it.text().split('/').joinToString("\n") { "${it.trim()}" })
}
@ -369,17 +369,20 @@ open class BatoTo(
manga.thumbnail_url = document.select("div.attr-cover img").attr("abs:src")
return manga
}
private fun parseStatus(workStatus: String?, uploadStatus: String?) = when {
workStatus == null -> SManga.UNKNOWN
workStatus.contains("Ongoing") -> SManga.ONGOING
workStatus.contains("Cancelled") -> SManga.CANCELLED
workStatus.contains("Hiatus") -> SManga.ON_HIATUS
workStatus.contains("Completed") -> when {
private fun parseStatus(workStatus: String?, uploadStatus: String?): Int {
val status = workStatus ?: uploadStatus
return when {
status == null -> SManga.UNKNOWN
status.contains("Ongoing") -> SManga.ONGOING
status.contains("Cancelled") -> SManga.CANCELLED
status.contains("Hiatus") -> SManga.ON_HIATUS
status.contains("Completed") -> when {
uploadStatus?.contains("Ongoing") == true -> SManga.PUBLISHING_FINISHED
else -> SManga.COMPLETED
}
else -> SManga.UNKNOWN
}
}
private fun altChapterParse(response: Response): List<SChapter> {
return Jsoup.parse(response.body.string(), response.request.url.toString(), Parser.xmlParser())