Fix single chapters not opening in MH (#16095)

Fix single chapters not opening in MH.
This commit is contained in:
Alessandro Jean 2023-04-18 15:18:47 -03:00 committed by GitHub
parent a912752ea5
commit 42abcb20b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 11 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Mundo Hentai'
pkgNameSuffix = 'pt.mundohentai'
extClass = '.MundoHentai'
extVersionCode = 6
extVersionCode = 7
isNsfw = true
}

View File

@ -108,16 +108,22 @@ class MundoHentai : ParsedHttpSource() {
override fun chapterListParse(response: Response): List<SChapter> {
val document = response.asJsoup()
val multipleChapters = document.select("div.listaImagens div.galeriaTab")
val multipleChapters = document.select(chapterListSelector())
if (multipleChapters.isNotEmpty()) {
return multipleChapters.map(::chapterFromElement).reversed()
}
return listOf(singleChapterFromElement(document.body()))
val singleChapter = SChapter.create().apply {
name = "Capítulo"
chapter_number = 1f
setUrlWithoutDomain(document.location())
}
override fun chapterListSelector(): String = "div.post-box.listaImagens"
return listOf(singleChapter)
}
override fun chapterListSelector(): String = "div.listaImagens div.galeriaTab"
override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply {
val chapterId = element.attr("data-id")
@ -128,14 +134,8 @@ class MundoHentai : ParsedHttpSource() {
setUrlWithoutDomain("${element.ownerDocument()!!.location()}#$chapterId")
}
private fun singleChapterFromElement(element: Element): SChapter = SChapter.create().apply {
name = "Capítulo"
chapter_number = 1f
setUrlWithoutDomain(element.ownerDocument()!!.location())
}
override fun pageListParse(document: Document): List<Page> {
val chapterId = document.location().substringAfterLast("#")
val chapterId = document.location().substringAfterLast("#", "")
val gallerySelector = when {
chapterId.isNotEmpty() -> "div.listaImagens #galeria-$chapterId img"
else -> "div.listaImagens ul.post-fotos img"