Skip to content

Commit

Permalink
very cool (#16811)
Browse files Browse the repository at this point in the history
* very cool fix

* more resilient probably
  • Loading branch information
AwkwardPeak7 authored Jun 21, 2023
1 parent 047a047 commit 1ff3293
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/en/reaperscans/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ext {
extName = 'Reaper Scans'
pkgNameSuffix = 'en.reaperscans'
extClass = '.ReaperScans'
extVersionCode = 45
extVersionCode = 46
}

apply from: "$rootDir/common.gradle"
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package eu.kanade.tachiyomi.extension.en.reaperscans

import android.util.Base64
import android.util.Log
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.POST
import eu.kanade.tachiyomi.network.interceptor.rateLimit
Expand All @@ -18,7 +19,6 @@ import kotlinx.serialization.json.add
import kotlinx.serialization.json.addJsonObject
import kotlinx.serialization.json.buildJsonObject
import kotlinx.serialization.json.contentOrNull
import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.json.jsonPrimitive
import kotlinx.serialization.json.put
import kotlinx.serialization.json.putJsonArray
Expand Down Expand Up @@ -290,7 +290,8 @@ class ReaperScans : ParsedHttpSource() {
val routeName = livewareData.fingerprint["name"]?.jsonPrimitive?.contentOrNull
?: error("Couldn't find routeName")

val tunstileName = livewareData.serverMemo["data"]?.jsonObject?.keys?.firstOrNull { it != "chapter" }
val tunstileName = document.selectFirst("script:containsData(captchacallback)")?.html()
?.let { tunstile.find(it)?.groupValues?.get(1) }
?: error("Couldn't fine Tunstile Name")

// Javascript: (Math.random() + 1).toString(36).substring(8)
Expand Down Expand Up @@ -322,7 +323,12 @@ class ReaperScans : ParsedHttpSource() {

val liveWireResponse = client.newCall(liveWireRequest).execute()

val html = liveWireResponse.parseJson<LiveWireResponseDto>().effects.html
val html = runCatching { liveWireResponse.parseJson<LiveWireResponseDto>().effects.html }
.getOrElse {
Log.e(name, it.stackTraceToString())
error("Fuck you Reaper Scans")
}

return Jsoup.parse(html, baseUrl).select("img").mapIndexed { idx, element ->
Page(idx, imageUrl = element.imgAttr())
}
Expand Down Expand Up @@ -400,5 +406,6 @@ class ReaperScans : ParsedHttpSource() {
companion object {
private val JSON_MEDIA_TYPE = "application/json; charset=utf-8".toMediaType()
const val PREFIX_ID_SEARCH = "id:"
private val tunstile by lazy { Regex("""set\s*\(\s*\"([^"]*)""") }
}
}

0 comments on commit 1ff3293

Please sign in to comment.