From 394a2be3b0c815839f71d14e9e200e87ca9c2f6e Mon Sep 17 00:00:00 2001 From: AntsyLich <59261191+AntsyLich@users.noreply.github.com> Date: Thu, 24 Nov 2022 22:00:38 +0600 Subject: [PATCH] Fix RealmScans (#14344) --- .../realmscans/src/RealmScans.kt | 31 ++----------------- .../mangathemesia/MangaThemesiaGenerator.kt | 2 +- 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/multisrc/overrides/mangathemesia/realmscans/src/RealmScans.kt b/multisrc/overrides/mangathemesia/realmscans/src/RealmScans.kt index db08abf09..b4a8ec861 100644 --- a/multisrc/overrides/mangathemesia/realmscans/src/RealmScans.kt +++ b/multisrc/overrides/mangathemesia/realmscans/src/RealmScans.kt @@ -3,11 +3,8 @@ package eu.kanade.tachiyomi.extension.en.realmscans import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.source.model.Page -import kotlinx.serialization.json.jsonArray -import kotlinx.serialization.json.jsonPrimitive import okhttp3.OkHttpClient import org.jsoup.nodes.Document -import java.lang.IllegalArgumentException import java.util.concurrent.TimeUnit class RealmScans : MangaThemesia( @@ -22,30 +19,8 @@ class RealmScans : MangaThemesia( .build() override fun pageListParse(document: Document): List { - val htmlPages = document.select(pageSelector) - .mapIndexed { i, img -> - val url = img.attr("data-wpfc-original-src") - .ifEmpty { img.attr("abs:src") } - - Page(i, "", url) - } - - countViews(document) - - // Some sites also loads pages via javascript - if (htmlPages.isNotEmpty()) { return htmlPages } - - val docString = document.toString() - val imageListJson = JSON_IMAGE_LIST_REGEX.find(docString)?.destructured?.toList()?.get(0).orEmpty() - val imageList = try { - json.parseToJsonElement(imageListJson).jsonArray - } catch (_: IllegalArgumentException) { - emptyList() - } - val scriptPages = imageList.mapIndexed { i, jsonEl -> - Page(i, "", jsonEl.jsonPrimitive.content) - } - - return scriptPages + return super.pageListParse(document) + .distinctBy { it.imageUrl } + .mapIndexed { i, page -> Page(i, imageUrl = page.imageUrl) } } } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt index c7899216a..7ee8aac44 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt @@ -91,7 +91,7 @@ class MangaThemesiaGenerator : ThemeSourceGenerator { SingleLang("Raiki Scan", "https://raikiscan.com", "es"), SingleLang("Rawkuma", "https://rawkuma.com/", "ja"), SingleLang("Readkomik", "https://readkomik.com", "en", className = "ReadKomik", overrideVersionCode = 1), - SingleLang("Realm Scans", "https://realmscans.com", "en", overrideVersionCode = 3), + SingleLang("Realm Scans", "https://realmscans.com", "en", overrideVersionCode = 4), SingleLang("Ryukonesia", "https://ryukonesia.net", "id"), SingleLang("Sekaikomik", "https://www.sekaikomik.live", "id", isNsfw = true, overrideVersionCode = 9), SingleLang("Sekaikomik", "https://www.sekaikomik.site", "id", isNsfw = true, overrideVersionCode = 8),