From df7d63a9b4286f13fb9959b768534e1a5b778892 Mon Sep 17 00:00:00 2001 From: Aria Moradi Date: Thu, 12 Nov 2020 16:39:32 +0330 Subject: [PATCH] Emerald: #4836: fix problem 1 for some cases (#4852) --- src/all/emerald/build.gradle | 2 +- .../eu/kanade/tachiyomi/extension/all/emerald/Emerald.kt | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/all/emerald/build.gradle b/src/all/emerald/build.gradle index 575885d12..869023515 100644 --- a/src/all/emerald/build.gradle +++ b/src/all/emerald/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'Emerald' pkgNameSuffix = 'all.emerald' extClass = '.EmeraldFactory' - extVersionCode = 5 + extVersionCode = 6 libVersion = '1.2' } diff --git a/src/all/emerald/src/eu/kanade/tachiyomi/extension/all/emerald/Emerald.kt b/src/all/emerald/src/eu/kanade/tachiyomi/extension/all/emerald/Emerald.kt index c64b81cff..581b1f7a4 100644 --- a/src/all/emerald/src/eu/kanade/tachiyomi/extension/all/emerald/Emerald.kt +++ b/src/all/emerald/src/eu/kanade/tachiyomi/extension/all/emerald/Emerald.kt @@ -269,6 +269,7 @@ open class Emerald( val pages = mutableListOf() val script = document.select("script").html() + if (script.contains("var images =")) { val imgJson = JSONObject(script.substringAfter("var images = ").substringBefore(";")) val imgNames = imgJson.names() @@ -280,7 +281,7 @@ open class Emerald( pages.add(Page(i, "", imgUrl)) } } - } else if (script.contains("const server =")) { + } else if (script.contains("const server =")) { // bato.to val duktape = Duktape.create() val encryptedServer = script.substringAfter("const server = ").substringBefore(";") val batojs = duktape.evaluate(script.substringAfter("const batojs = ").substringBefore(";")).toString() @@ -298,7 +299,11 @@ open class Emerald( } else { for (i in 0 until imgArray.length()) { val imgUrl = imgArray.get(i) - pages.add(Page(i, "", "https:${server}$imgUrl")) + if (server.startsWith("http")) + pages.add(Page(i, "", "${server}$imgUrl")) + else + pages.add(Page(i, "", "https:${server}$imgUrl")) + } } }