Przeglądaj źródła

Kissmanga fix. Kotlin 1.1.1

len 8 lat temu
rodzic
commit
3be9881997

+ 2 - 2
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()
     }

+ 29 - 6
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<Page> {
+        val body = response.body().string()
+
+        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<Page>()
-        //language=RegExp
-        val p = Pattern.compile("""lstImages.push\("(.+?)"""")
-        val m = p.matcher(response.body().string())
 
-        var i = 0
-        while (m.find()) {
-            pages.add(Page(i++, "", m.group(1)))
+        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
     }
 

+ 0 - 1
build.gradle

@@ -17,6 +17,5 @@ allprojects {
     repositories {
         jcenter()
         maven { url "https://jitpack.io" }
-        maven { url "https://dl.bintray.com/inorichi/maven" }
     }
 }