From 3be9881997fe8358d725a651710ae55ec382935e Mon Sep 17 00:00:00 2001 From: len Date: Sat, 18 Mar 2017 14:11:16 +0100 Subject: [PATCH] Kissmanga fix. Kotlin 1.1.1 --- app/build.gradle | 4 +- .../source/online/english/Kissmanga.kt | 37 +++++++++++++++---- build.gradle | 1 - 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index aea6280e3..de7921f21 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -101,7 +101,7 @@ android { dependencies { // Modified dependencies - compile 'com.github.inorichi:subsampling-scale-image-view:4255750' + compile 'com.github.inorichi:subsampling-scale-image-view:01e5385' compile 'com.github.inorichi:junrar-android:634c1f5' // Android support library @@ -212,7 +212,7 @@ dependencies { } buildscript { - ext.kotlin_version = '1.1.0' + ext.kotlin_version = '1.1.1' repositories { mavenCentral() } diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/online/english/Kissmanga.kt b/app/src/main/java/eu/kanade/tachiyomi/source/online/english/Kissmanga.kt index 1ebff79d8..d9753e91b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/online/english/Kissmanga.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/online/english/Kissmanga.kt @@ -1,5 +1,6 @@ package eu.kanade.tachiyomi.source.online.english +import com.squareup.duktape.Duktape import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.POST import eu.kanade.tachiyomi.source.model.* @@ -114,15 +115,37 @@ class Kissmanga : ParsedHttpSource() { override fun pageListRequest(chapter: SChapter) = POST(baseUrl + chapter.url, headers) override fun pageListParse(response: Response): List { - val pages = mutableListOf() - //language=RegExp - val p = Pattern.compile("""lstImages.push\("(.+?)"""") - val m = p.matcher(response.body().string()) + val body = response.body().string() - var i = 0 - while (m.find()) { - pages.add(Page(i++, "", m.group(1))) + val ca = client.newCall(GET("$baseUrl/Scripts/ca.js", headers)).execute() + val lo = client.newCall(GET("$baseUrl/Scripts/lo.js", headers)).execute() + + val caBody = ca.body().string() + val loBody = lo.body().string() + + val pages = mutableListOf() + + Duktape.create().use { + + it.evaluate(caBody) + it.evaluate(loBody) + + var p = Pattern.compile("(.*CryptoJS.*)") + var m = p.matcher(body) + while (m.find()) { + it.evaluate(m.group(1)) + } + + p = Pattern.compile("""lstImages.push\((.*)\);""") + m = p.matcher(body) + + var i = 0 + while (m.find()) { + val url = it.evaluate(m.group(1)) as String + pages.add(Page(i++, "", url)) + } } + return pages } diff --git a/build.gradle b/build.gradle index 993857423..92ecf821a 100644 --- a/build.gradle +++ b/build.gradle @@ -17,6 +17,5 @@ allprojects { repositories { jcenter() maven { url "https://jitpack.io" } - maven { url "https://dl.bintray.com/inorichi/maven" } } }