From 7d7552af06aa14cf5fabf2e13115da46a1376bc2 Mon Sep 17 00:00:00 2001 From: stevenyomi <95685115+stevenyomi@users.noreply.github.com> Date: Mon, 9 Jan 2023 18:27:44 +0800 Subject: [PATCH] MangaRaw: fix page list (#14829) --- multisrc/overrides/mangaraw/manga9co/src/MangaRaw.kt | 10 +++------- .../mangaraw/manga9co/src/MangaRawConstants.kt | 4 ++-- .../overrides/mangaraw/mangarawru/src/MangaRawRU.kt | 1 + .../tachiyomi/multisrc/mangaraw}/ImageListParser.kt | 2 +- .../tachiyomi/multisrc/mangaraw/MangaRawGenerator.kt | 2 +- 5 files changed, 8 insertions(+), 11 deletions(-) rename multisrc/{overrides/mangaraw/mangarawru/src => src/main/java/eu/kanade/tachiyomi/multisrc/mangaraw}/ImageListParser.kt (98%) diff --git a/multisrc/overrides/mangaraw/manga9co/src/MangaRaw.kt b/multisrc/overrides/mangaraw/manga9co/src/MangaRaw.kt index 8fd2f0e93..65e3090a0 100644 --- a/multisrc/overrides/mangaraw/manga9co/src/MangaRaw.kt +++ b/multisrc/overrides/mangaraw/manga9co/src/MangaRaw.kt @@ -1,9 +1,9 @@ package eu.kanade.tachiyomi.extension.ja.manga9co import android.app.Application -import android.util.Base64 import androidx.preference.ListPreference import androidx.preference.PreferenceScreen +import eu.kanade.tachiyomi.multisrc.mangaraw.ImageListParser import eu.kanade.tachiyomi.multisrc.mangaraw.MangaRawTheme import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.source.ConfigurableSource @@ -72,12 +72,8 @@ class MangaRaw : MangaRawTheme("MangaRaw", ""), ConfigurableSource { override fun pageListParse(response: Response): List { if (!isPagesShuffled) return super.pageListParse(response) val html = response.body!!.string() - val startText = "let ads = '" - val startIndex = html.indexOf(startText) + startText.length - val endIndex = html.indexOf('\'', startIndex) - val base64 = html.substring(startIndex, endIndex) - val decoded = String(Base64.decode(base64, Base64.DEFAULT)) - return decoded.split(",").mapIndexed { index, imageUrl -> + val imageList = ImageListParser(html, 32).getImageList() ?: return emptyList() + return imageList.mapIndexed { index, imageUrl -> Page(index, imageUrl = imageUrl) } } diff --git a/multisrc/overrides/mangaraw/manga9co/src/MangaRawConstants.kt b/multisrc/overrides/mangaraw/manga9co/src/MangaRawConstants.kt index 5c0f08694..c6a34973e 100644 --- a/multisrc/overrides/mangaraw/manga9co/src/MangaRawConstants.kt +++ b/multisrc/overrides/mangaraw/manga9co/src/MangaRawConstants.kt @@ -27,8 +27,8 @@ internal fun getSelectors(mirrorIndex: Int) = when (mirrorIndex) { internal fun needUrlSanitize(mirrorIndex: Int) = mirrorIndex == 2 internal fun isPagesShuffled(mirrorIndex: Int) = when (mirrorIndex) { - 1, 3 -> true - else -> false + 0 -> false + else -> true } internal val mangaSlugRegex = Regex("""^/mz[a-z]{4}-""") diff --git a/multisrc/overrides/mangaraw/mangarawru/src/MangaRawRU.kt b/multisrc/overrides/mangaraw/mangarawru/src/MangaRawRU.kt index 8646493c0..d610438e5 100644 --- a/multisrc/overrides/mangaraw/mangarawru/src/MangaRawRU.kt +++ b/multisrc/overrides/mangaraw/mangarawru/src/MangaRawRU.kt @@ -1,5 +1,6 @@ package eu.kanade.tachiyomi.extension.ja.mangarawru +import eu.kanade.tachiyomi.multisrc.mangaraw.ImageListParser import eu.kanade.tachiyomi.multisrc.mangaraw.MangaRawTheme import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.source.model.FilterList diff --git a/multisrc/overrides/mangaraw/mangarawru/src/ImageListParser.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangaraw/ImageListParser.kt similarity index 98% rename from multisrc/overrides/mangaraw/mangarawru/src/ImageListParser.kt rename to multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangaraw/ImageListParser.kt index 57f943b56..79f8b4504 100644 --- a/multisrc/overrides/mangaraw/mangarawru/src/ImageListParser.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangaraw/ImageListParser.kt @@ -1,4 +1,4 @@ -package eu.kanade.tachiyomi.extension.ja.mangarawru +package eu.kanade.tachiyomi.multisrc.mangaraw import kotlin.math.pow diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangaraw/MangaRawGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangaraw/MangaRawGenerator.kt index 10377dffb..1c7c343ca 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangaraw/MangaRawGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangaraw/MangaRawGenerator.kt @@ -12,7 +12,7 @@ class MangaRawGenerator : ThemeSourceGenerator { override val sources = listOf( SingleLang("SyoSetu", "https://syosetu.top", "ja"), - SingleLang("MangaRaw", "https://manga1001.in", "ja", pkgName = "manga9co", overrideVersionCode = 1), + SingleLang("MangaRaw", "https://manga1001.in", "ja", pkgName = "manga9co", overrideVersionCode = 2), SingleLang("MangaRawRU", "https://mangaraw.ru", "ja", overrideVersionCode = 1), )