From 4030cebbbf35a70e801c2bbd60e583b41ae123b2 Mon Sep 17 00:00:00 2001 From: Secozzi <49240133+Secozzi@users.noreply.github.com> Date: Fri, 19 Apr 2024 13:51:22 +0000 Subject: [PATCH] fix liliana page order (#2473) --- lib-multisrc/liliana/build.gradle.kts | 2 +- .../tachiyomi/multisrc/liliana/Liliana.kt | 14 +++++++++++--- .../extension/ja/mangakoma/MangaKoma.kt | 17 ++++++++++------- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/lib-multisrc/liliana/build.gradle.kts b/lib-multisrc/liliana/build.gradle.kts index dc076cc37..9dce2478c 100644 --- a/lib-multisrc/liliana/build.gradle.kts +++ b/lib-multisrc/liliana/build.gradle.kts @@ -2,4 +2,4 @@ plugins { id("lib-multisrc") } -baseVersionCode = 1 +baseVersionCode = 2 diff --git a/lib-multisrc/liliana/src/eu/kanade/tachiyomi/multisrc/liliana/Liliana.kt b/lib-multisrc/liliana/src/eu/kanade/tachiyomi/multisrc/liliana/Liliana.kt index fcd6fbb23..760934ec7 100644 --- a/lib-multisrc/liliana/src/eu/kanade/tachiyomi/multisrc/liliana/Liliana.kt +++ b/lib-multisrc/liliana/src/eu/kanade/tachiyomi/multisrc/liliana/Liliana.kt @@ -322,9 +322,17 @@ abstract class Liliana( } override fun pageListParse(document: Document): List { - return document.select("div.separator").mapIndexed { i, page -> - val url = page.selectFirst("a")!!.attr("abs:href") - Page(i, document.location(), url) + return if (document.selectFirst("div.separator[data-index]") == null) { + document.select("div.separator").mapIndexed { i, page -> + 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 } } } diff --git a/src/ja/mangakoma/src/eu/kanade/tachiyomi/extension/ja/mangakoma/MangaKoma.kt b/src/ja/mangakoma/src/eu/kanade/tachiyomi/extension/ja/mangakoma/MangaKoma.kt index d3c31cb15..165a75dfb 100644 --- a/src/ja/mangakoma/src/eu/kanade/tachiyomi/extension/ja/mangakoma/MangaKoma.kt +++ b/src/ja/mangakoma/src/eu/kanade/tachiyomi/extension/ja/mangakoma/MangaKoma.kt @@ -1,15 +1,18 @@ package eu.kanade.tachiyomi.extension.ja.mangakoma import eu.kanade.tachiyomi.multisrc.liliana.Liliana +import eu.kanade.tachiyomi.network.GET 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") { - override fun pageListParse(document: Document): List { - return 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 } + override fun imageRequest(page: Page): Request { + val imgHeaders = headersBuilder().apply { + add("Accept", "image/avif,image/webp,*/*") + add("Host", page.imageUrl!!.toHttpUrl().host) + removeAll("Referer") + }.build() + return GET(page.imageUrl!!, imgHeaders) } }