From 626fbd05344d4f7e47d204e1779cf5081e5ff361 Mon Sep 17 00:00:00 2001 From: bapeey <90949336+bapeey@users.noreply.github.com> Date: Mon, 20 Nov 2023 12:51:06 -0500 Subject: [PATCH] LikeManga: Fix "Image couldn't be loaded" (#19046) Get imgCdn url from document --- src/en/likemanga/build.gradle | 2 +- .../eu/kanade/tachiyomi/extension/en/likemanga/LikeManga.kt | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/en/likemanga/build.gradle b/src/en/likemanga/build.gradle index db09bce60..a0c5dc3b2 100644 --- a/src/en/likemanga/build.gradle +++ b/src/en/likemanga/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'LikeManga' pkgNameSuffix = 'en.likemanga' extClass = '.LikeManga' - extVersionCode = 2 + extVersionCode = 3 } apply from: "$rootDir/common.gradle" diff --git a/src/en/likemanga/src/eu/kanade/tachiyomi/extension/en/likemanga/LikeManga.kt b/src/en/likemanga/src/eu/kanade/tachiyomi/extension/en/likemanga/LikeManga.kt index 042571164..ea4104cec 100644 --- a/src/en/likemanga/src/eu/kanade/tachiyomi/extension/en/likemanga/LikeManga.kt +++ b/src/en/likemanga/src/eu/kanade/tachiyomi/extension/en/likemanga/LikeManga.kt @@ -33,8 +33,6 @@ class LikeManga : ParsedHttpSource() { override val baseUrl = "https://likemanga.io" - private val imgCdnUrl = "https://like1.likemanga.io" - override val supportsLatest = true override val client = network.cloudflareClient.newBuilder() @@ -258,6 +256,9 @@ class LikeManga : ParsedHttpSource() { val element = document.selectFirst("div.reading input#next_img_token") if (element != null) { + val imgCdnUrl = document.selectFirst("div.reading #currentlink")?.attr("value") + ?: throw Exception("Could not find image CDN URL") + val token = element.attr("value").split(".")[1] val jsonData = json.parseToJsonElement(String(Base64.decode(token, Base64.DEFAULT))).jsonObject val encodedImgArray = jsonData["data"]!!.jsonPrimitive.content