From 05d7a6951f706e935922f7b867f5909b2775ba18 Mon Sep 17 00:00:00 2001 From: happywillow0 <45346080+happywillow0@users.noreply.github.com> Date: Fri, 22 Nov 2019 17:46:54 -0500 Subject: [PATCH] [Fix] Mangahere - Parser for webtoon type (#1810) * Update build.gradle * Added Webtoon Parser * Update Mangahere.kt Missed a ' --- src/en/mangahere/build.gradle | 2 +- .../tachiyomi/extension/en/mangahere/Mangahere.kt | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/en/mangahere/build.gradle b/src/en/mangahere/build.gradle index 4e694a982..bcb1bfbc2 100644 --- a/src/en/mangahere/build.gradle +++ b/src/en/mangahere/build.gradle @@ -5,7 +5,7 @@ ext { appName = 'Tachiyomi: Mangahere' pkgNameSuffix = 'en.mangahere' extClass = '.Mangahere' - extVersionCode = 10 + extVersionCode = 11 libVersion = '1.2' } diff --git a/src/en/mangahere/src/eu/kanade/tachiyomi/extension/en/mangahere/Mangahere.kt b/src/en/mangahere/src/eu/kanade/tachiyomi/extension/en/mangahere/Mangahere.kt index effbcc461..a98d2b440 100644 --- a/src/en/mangahere/src/eu/kanade/tachiyomi/extension/en/mangahere/Mangahere.kt +++ b/src/en/mangahere/src/eu/kanade/tachiyomi/extension/en/mangahere/Mangahere.kt @@ -192,6 +192,19 @@ class Mangahere : ParsedHttpSource() { } override fun pageListParse(document: Document): List { + val bar = document.select("script[src*=chapter_bar]") + if (!bar.isNullOrEmpty()){ + val script = document.select("script:containsData(function(p,a,c,k,e,d))").html().removePrefix("eval") + val duktape = Duktape.create() + val DeobfuscatedScript = duktape.evaluate(script).toString() + val urls = DeobfuscatedScript.substringAfter("newImgs=['").substringBefore("'];").split("','") + duktape.close() + val pages = mutableListOf() + urls.forEachIndexed { index, s -> + pages.add(Page(index, "", "http:$s")) + } + return pages + } else { val html = document.html() val link = document.location() @@ -259,6 +272,7 @@ class Mangahere : ParsedHttpSource() { duktape.close() return pages + } } private fun extractSecretKey(html: String, duktape: Duktape): String {