Japscan fix (#10651)

Japscan:
 - fix manhua & manhwa url
 - better error management
This commit is contained in:
Justin COLLON 2025-09-21 20:44:08 +02:00 committed by Draff
parent 588b4d8bf4
commit 250ab83b35
Signed by: Draff
GPG Key ID: E8A89F3211677653
2 changed files with 7 additions and 4 deletions

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'Japscan' extName = 'Japscan'
extClass = '.Japscan' extClass = '.Japscan'
extVersionCode = 51 extVersionCode = 52
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -227,13 +227,16 @@ class Japscan : ConfigurableSource, ParsedHttpSource() {
// Those have a span.badge "SPOILER" or "RAW". The additional pseudo selector makes sure to exclude these from the chapter list. // Those have a span.badge "SPOILER" or "RAW". The additional pseudo selector makes sure to exclude these from the chapter list.
override fun chapterFromElement(element: Element): SChapter { override fun chapterFromElement(element: Element): SChapter {
val urlElement = element.selectFirst("*[href~=manga]")!! val urlElement = element.selectFirst("*[href~=manga|manhua|manhwa]")
if (urlElement == null) {
throw Exception("Impossible de trouver l'URL du chapitre")
}
val chapter = SChapter.create() val chapter = SChapter.create()
chapter.setUrlWithoutDomain(urlElement.attr("href")) chapter.setUrlWithoutDomain(urlElement.attr("href"))
chapter.name = urlElement.ownText() chapter.name = urlElement.ownText()
// Using ownText() doesn't include childs' text, like "VUS" or "RAW" badges, in the chapter name. // Using ownText() doesn't include child's text, like "VUS" or "RAW" badges, in the chapter name.
chapter.date_upload = element.selectFirst("span")!!.text().trim().let { parseChapterDate(it) } chapter.date_upload = element.selectFirst("span")?.text()?.trim()?.let { parseChapterDate(it) } ?: 0L
return chapter return chapter
} }