Mangago: fix descrambling (#3313)

* Mangago: fix descrambling

* bump
This commit is contained in:
AwkwardPeak7 2024-06-01 09:22:29 +05:00 committed by GitHub
parent c4ad275f91
commit fb4eb99065
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 6 deletions

View File

@ -1,7 +1,7 @@
ext {
extName = 'Mangago'
extClass = '.Mangago'
extVersionCode = 14
extVersionCode = 15
isNsfw = true
}

View File

@ -44,9 +44,10 @@ class Mangago : ParsedHttpSource() {
override val client = network.cloudflareClient.newBuilder()
.rateLimit(1, 2)
.addInterceptor { chain ->
val response = chain.proceed(chain.request())
val request = chain.request()
val response = chain.proceed(request)
val fragment = response.request.url.fragment ?: return@addInterceptor response
val fragment = request.url.fragment ?: return@addInterceptor response
// desckey=...&cols=...
val key = fragment.substringAfter("desckey=").substringBefore("&")
@ -226,9 +227,7 @@ class Mangago : ParsedHttpSource() {
// This usually means that the list is already unscrambled.
}
val cols = deobfChapterJs
.substringAfter("var widthnum=heightnum=")
.substringBefore(";")
val cols = colsRegex.find(deobfChapterJs)?.groupValues?.get(1) ?: ""
return imageList
.split(",")
@ -458,6 +457,9 @@ class Mangago : ParsedHttpSource() {
Regex("""var imgsrcs\s*=\s*['"]([a-zA-Z0-9+=/]+)['"]""")
}
private val colsRegex =
Regex("""var\s*widthnum\s*=\s*heightnum\s*=\s*(\d+);""")
private val replacePosBytecode by lazy {
QuickJs.create().use {
it.compile(