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'
|
||||
themePkg = 'mangathemesia'
|
||||
baseUrl = 'https://luascans.com'
|
||||
overrideVersionCode = 2
|
||||
overrideVersionCode = 3
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
||||
|
|
|
@ -30,12 +30,12 @@ class LuaScans : MangaThemesia(
|
|||
return if (document.selectFirst("script:containsData(wafff)") != null) {
|
||||
val script = document.selectFirst("script:containsData(wafff)")!!.data()
|
||||
|
||||
val cookie = script.substringAfter("document.cookie=\"")
|
||||
.substringBefore("\"")
|
||||
val cookie = waffRegex.find(script)?.groups?.get("waff")?.value
|
||||
?.let { Cookie.parse(request.url, it) }
|
||||
|
||||
client.cookieJar.saveFromResponse(
|
||||
request.url,
|
||||
listOfNotNull(Cookie.parse(request.url, cookie)),
|
||||
listOfNotNull(cookie),
|
||||
)
|
||||
|
||||
response.close()
|
||||
|
@ -45,4 +45,6 @@ class LuaScans : MangaThemesia(
|
|||
response
|
||||
}
|
||||
}
|
||||
|
||||
private val waffRegex = Regex("""document\.cookie\s*=\s*['"](?<waff>.*)['"]""")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue