Add migrate warning on chapter parsing in GM as well (#17249)

Add migrate warning on chapter parsing in GM as well.
This commit is contained in:
Alessandro Jean 2023-07-24 18:19:43 -03:00 committed by GitHub
parent 72c75cd579
commit 369e48f362
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Golden Mangás'
pkgNameSuffix = 'pt.goldenmangas'
extClass = '.GoldenMangas'
extVersionCode = 18
extVersionCode = 19
isNsfw = true
}

View File

@ -163,7 +163,11 @@ class GoldenMangas : ParsedHttpSource() {
throw Exception(CHAPTER_IS_NOVEL_ERROR)
}
return chapterImages!!.select("img[pag]")
if (chapterImages == null) {
throw Exception(MIGRATE_WARNING)
}
return chapterImages.select("img[pag]")
.mapIndexed { i, element ->
Page(i, document.location(), element.attr("abs:src"))
}
@ -181,7 +185,7 @@ class GoldenMangas : ParsedHttpSource() {
}
private fun String.toDate(): Long {
return runCatching { DATE_FORMATTER.parse(trim())?. time }
return runCatching { DATE_FORMATTER.parse(trim())?.time }
.getOrNull() ?: 0L
}
@ -210,7 +214,7 @@ class GoldenMangas : ParsedHttpSource() {
private const val MIGRATE_WARNING = "Migre o item da Golden Mangás para Golden Mangás para atualizar a URL."
private val DATE_FORMATTER by lazy {
SimpleDateFormat("(dd/MM/yyyy)", Locale.ENGLISH)
SimpleDateFormat("(dd/MM/yyyy)", Locale("pt", "BR"))
}
}
}