From 3f0107693651e29160408393fd00aa2649938454 Mon Sep 17 00:00:00 2001 From: "(e)x(otic) Ne(e)t" <16914200+DOTzX@users.noreply.github.com> Date: Sun, 12 Jun 2022 21:14:10 +0700 Subject: [PATCH] Komik Cast - Fix match result return null (not found) (#12164) * Komik Cast - Fix match result return null (not found) * Komik Cast - Updating overrideVersionCode --- .../wpmangastream/komikcast/src/KomikCast.kt | 21 ++++++++++++------- .../wpmangastream/WPMangaStreamGenerator.kt | 2 +- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/multisrc/overrides/wpmangastream/komikcast/src/KomikCast.kt b/multisrc/overrides/wpmangastream/komikcast/src/KomikCast.kt index d24ad2174..651836f3a 100644 --- a/multisrc/overrides/wpmangastream/komikcast/src/KomikCast.kt +++ b/multisrc/overrides/wpmangastream/komikcast/src/KomikCast.kt @@ -157,16 +157,23 @@ class KomikCast : WPMangaStream("Komik Cast", "https://komikcast.me", "id") { } override fun pageListParse(document: Document): List { + var doc = document + var cssQuery = "div#chapter_body .main-reading-area img.size-full" val imageListRegex = Regex("chapterImages = (.*) \\|\\|") - val imageListJson = imageListRegex.find(document.toString())!!.destructured.toList()[0] - val imageList = json.parseToJsonElement(imageListJson).jsonObject + val imageListMatchResult = imageListRegex.find(document.toString()) - var imageServer = "cdn" - if (!imageList.containsKey(imageServer)) imageServer = imageList.keys.first() - val imageElement = imageList[imageServer]!!.jsonArray.joinToString("") - val doc = Jsoup.parse(json.decodeFromString(imageElement)) + if (imageListMatchResult != null) { + val imageListJson = imageListMatchResult.destructured.toList()[0] + val imageList = json.parseToJsonElement(imageListJson).jsonObject - return doc.select("img.size-full") + var imageServer = "cdn" + if (!imageList.containsKey(imageServer)) imageServer = imageList.keys.first() + val imageElement = imageList[imageServer]!!.jsonArray.joinToString("") + doc = Jsoup.parse(json.decodeFromString(imageElement)) + cssQuery = "img.size-full" + } + + return doc.select(cssQuery) .mapIndexed { i, img -> Page(i, "", img.attr("abs:Src")) } } diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/wpmangastream/WPMangaStreamGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/wpmangastream/WPMangaStreamGenerator.kt index 6205ebc11..8b3ce9654 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/wpmangastream/WPMangaStreamGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/wpmangastream/WPMangaStreamGenerator.kt @@ -22,7 +22,7 @@ class WPMangaStreamGenerator : ThemeSourceGenerator { SingleLang("Kanzenin", "https://kanzenin.xyz", "id", isNsfw = true), SingleLang("KlanKomik", "https://klankomik.com", "id", overrideVersionCode = 1), SingleLang("Komik AV", "https://komikav.com", "id", overrideVersionCode = 1), - SingleLang("Komik Cast", "https://komikcast.me", "id", overrideVersionCode = 11), + SingleLang("Komik Cast", "https://komikcast.me", "id", overrideVersionCode = 12), SingleLang("Komik Station", "https://komikstation.co", "id", overrideVersionCode = 3), SingleLang("KomikIndo.co", "https://komikindo.co", "id", className = "KomikindoCo", overrideVersionCode = 3), SingleLang("Kuma Scans (Kuma Translation)", "https://kumascans.com", "en", className = "KumaScans", overrideVersionCode = 1),