LS: use regex for cookie extraction (#3441)
* LuaScan: use regex for cookie extraction * retry anyway
This commit is contained in:
parent
681bde548b
commit
1f4c56a57c
|
@ -3,7 +3,7 @@ ext {
|
||||||
extClass = '.LuaScans'
|
extClass = '.LuaScans'
|
||||||
themePkg = 'mangathemesia'
|
themePkg = 'mangathemesia'
|
||||||
baseUrl = 'https://luascans.com'
|
baseUrl = 'https://luascans.com'
|
||||||
overrideVersionCode = 2
|
overrideVersionCode = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
|
|
@ -30,12 +30,12 @@ class LuaScans : MangaThemesia(
|
||||||
return if (document.selectFirst("script:containsData(wafff)") != null) {
|
return if (document.selectFirst("script:containsData(wafff)") != null) {
|
||||||
val script = document.selectFirst("script:containsData(wafff)")!!.data()
|
val script = document.selectFirst("script:containsData(wafff)")!!.data()
|
||||||
|
|
||||||
val cookie = script.substringAfter("document.cookie=\"")
|
val cookie = waffRegex.find(script)?.groups?.get("waff")?.value
|
||||||
.substringBefore("\"")
|
?.let { Cookie.parse(request.url, it) }
|
||||||
|
|
||||||
client.cookieJar.saveFromResponse(
|
client.cookieJar.saveFromResponse(
|
||||||
request.url,
|
request.url,
|
||||||
listOfNotNull(Cookie.parse(request.url, cookie)),
|
listOfNotNull(cookie),
|
||||||
)
|
)
|
||||||
|
|
||||||
response.close()
|
response.close()
|
||||||
|
@ -45,4 +45,6 @@ class LuaScans : MangaThemesia(
|
||||||
response
|
response
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val waffRegex = Regex("""document\.cookie\s*=\s*['"](?<waff>.*)['"]""")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue