fix liliana page order (#2473)

This commit is contained in:
Secozzi 2024-04-19 13:51:22 +00:00 committed by Draff
parent 0e20357684
commit 4030cebbbf
3 changed files with 22 additions and 11 deletions

View File

@ -2,4 +2,4 @@ plugins {
id("lib-multisrc") id("lib-multisrc")
} }
baseVersionCode = 1 baseVersionCode = 2

View File

@ -322,9 +322,17 @@ abstract class Liliana(
} }
override fun pageListParse(document: Document): List<Page> { override fun pageListParse(document: Document): List<Page> {
return document.select("div.separator").mapIndexed { i, page -> return if (document.selectFirst("div.separator[data-index]") == null) {
val url = page.selectFirst("a")!!.attr("abs:href") document.select("div.separator").mapIndexed { i, page ->
Page(i, document.location(), url) val url = page.selectFirst("a")!!.attr("abs:href")
Page(i, document.location(), url)
}
} else {
document.select("div.separator[data-index]").map { page ->
val index = page.attr("data-index").toInt()
val url = page.selectFirst("a")!!.attr("abs:href")
Page(index, document.location(), url)
}.sortedBy { it.index }
} }
} }

View File

@ -1,15 +1,18 @@
package eu.kanade.tachiyomi.extension.ja.mangakoma package eu.kanade.tachiyomi.extension.ja.mangakoma
import eu.kanade.tachiyomi.multisrc.liliana.Liliana import eu.kanade.tachiyomi.multisrc.liliana.Liliana
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.Page
import org.jsoup.nodes.Document import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.Request
class MangaKoma : Liliana("Manga Koma", "https://mangakoma01.net", "ja") { class MangaKoma : Liliana("Manga Koma", "https://mangakoma01.net", "ja") {
override fun pageListParse(document: Document): List<Page> { override fun imageRequest(page: Page): Request {
return document.select("div.separator[data-index]").map { page -> val imgHeaders = headersBuilder().apply {
val index = page.attr("data-index").toInt() add("Accept", "image/avif,image/webp,*/*")
val url = page.selectFirst("a")!!.attr("abs:href") add("Host", page.imageUrl!!.toHttpUrl().host)
Page(index, document.location(), url) removeAll("Referer")
}.sortedBy { it.index } }.build()
return GET(page.imageUrl!!, imgHeaders)
} }
} }