Yushuke Mangas: Fix chapters list and pages (#7504)

fix: chapters list and pages
This commit is contained in:
Hellkaros 2025-02-07 12:57:40 -03:00 committed by Draff
parent a473bfca82
commit d6e5553084
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
2 changed files with 16 additions and 6 deletions

View File

@ -1,7 +1,7 @@
ext {
extName = 'Yushuke Mangas'
extClass = '.YushukeMangas'
extVersionCode = 3
extVersionCode = 4
}
apply from: "$rootDir/common.gradle"

View File

@ -163,7 +163,14 @@ class YushukeMangas : ParsedHttpSource() {
override fun chapterListSelector() = "a.chapter-item"
override fun chapterFromElement(element: Element) = SChapter.create().apply {
name = element.selectFirst(".chapter-number")!!.text()
val capituloTexto = element.select(".capitulo-numero")
.textNodes()
.joinToString(" ") { it.text().trim() }
.split(" ")
.take(2)
.joinToString(" ")
name = capituloTexto
setUrlWithoutDomain(element.absUrl("href"))
}
@ -180,7 +187,7 @@ class YushukeMangas : ParsedHttpSource() {
}
private fun fetchChapterListPage(mangaId: String, page: Int): Response {
val url = "$baseUrl/ajax/carregar_capitulos.php?order=DESC".toHttpUrl().newBuilder()
val url = "$baseUrl/ajax/lzmvke.php?order=DESC".toHttpUrl().newBuilder()
.addQueryParameter("manga_id", mangaId)
.addQueryParameter("page", page.toString())
.build()
@ -193,8 +200,11 @@ class YushukeMangas : ParsedHttpSource() {
// ============================== Pages ===============================
override fun pageListParse(document: Document): List<Page> {
return document.select(".manga-container .manga-image").mapIndexed { index, imageUrl ->
Page(index, imageUrl = imageUrl.absUrl("src"))
return document.select("div.select-nav + * picture")
.mapIndexedNotNull { index, pictureElement ->
val imgElement = pictureElement.selectFirst("img")
val imageUrl = imgElement?.attr("src")?.takeIf { it.isNotBlank() } ?: return@mapIndexedNotNull null
Page(index, imageUrl = "$baseUrl$imageUrl")
}
}