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' extName = 'TuMangaOnline'
pkgNameSuffix = 'es.tumangaonline' pkgNameSuffix = 'es.tumangaonline'
extClass = '.TuMangaOnline' extClass = '.TuMangaOnline'
extVersionCode = 39 extVersionCode = 40
isNsfw = true isNsfw = true
} }

View File

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