Fix chapter name and number (#15259)

This commit is contained in:
seew3l 2023-02-07 07:49:34 -05:00 committed by GitHub
parent 2a8cb31465
commit 651acb7e1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 11 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'TuMangaOnline'
pkgNameSuffix = 'es.tumangaonline'
extClass = '.TuMangaOnline'
extVersionCode = 39
extVersionCode = 40
isNsfw = true
}

View File

@ -183,17 +183,12 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() {
// Regular list of chapters
val chapters = mutableListOf<SChapter>()
document.select(regularChapterListSelector()).forEach { chapelement ->
val chapternumber = chapelement.select("a.btn-collapse").text()
.substringBefore(":")
.substringAfter("Capítulo")
.trim()
.toFloat()
val chaptername = chapelement.select("div.col-10.text-truncate").text()
val chaptername = chapelement.select("div.col-10.text-truncate").text().replace("&nbsp;", " ").trim()
val scanelement = chapelement.select("ul.chapter-list > li")
if (getScanlatorPref()) {
scanelement.forEach { chapters.add(regularChapterFromElement(it, chaptername, chapternumber)) }
scanelement.forEach { chapters.add(regularChapterFromElement(it, chaptername)) }
} else {
scanelement.first { chapters.add(regularChapterFromElement(it, chaptername, chapternumber)) }
scanelement.first { chapters.add(regularChapterFromElement(it, chaptername)) }
}
}
return chapters
@ -209,10 +204,9 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() {
?: 0
}
private fun regularChapterListSelector() = "div.chapters > ul.list-group li.p-0.list-group-item"
private fun regularChapterFromElement(element: Element, chName: String, number: Float) = SChapter.create().apply {
private fun regularChapterFromElement(element: Element, chName: String) = SChapter.create().apply {
url = element.select("div.row > .text-right > a").attr("href")
name = chName
chapter_number = number
scanlator = element.select("div.col-md-6.text-truncate")?.text()
date_upload = element.select("span.badge.badge-primary.p-2").first()?.text()?.let { parseChapterDate(it) }
?: 0