Close instances of Duktape (#9363)
This commit is contained in:
parent
2d7556ba8d
commit
93988e8990
@ -275,7 +275,6 @@ open class MangaPark(
|
||||
throw Exception("The chapter content seems to be deleted.\n\nContact the site owner if possible.")
|
||||
}
|
||||
|
||||
val duktape = Duktape.create()
|
||||
val script = document.select("script").html()
|
||||
val imgCdnHost = script.substringAfter("const imgCdnHost = \"").substringBefore("\";")
|
||||
val imgPathLisRaw = script.substringAfter("const imgPathLis = ").substringBefore(";")
|
||||
@ -286,7 +285,7 @@ open class MangaPark(
|
||||
val decryptScript =
|
||||
cryptoJS + "CryptoJS.AES.decrypt($amWord, $amPass).toString(CryptoJS.enc.Utf8);"
|
||||
|
||||
val imgWordLisRaw = duktape.evaluate(decryptScript).toString()
|
||||
val imgWordLisRaw = Duktape.create().use { it.evaluate(decryptScript).toString() }
|
||||
val imgWordLis = json.parseToJsonElement(imgWordLisRaw).jsonArray
|
||||
|
||||
return imgWordLis.mapIndexed { i, imgWordE ->
|
||||
|
@ -257,13 +257,11 @@ class Mangahere : ParsedHttpSource() {
|
||||
val pageBase = link.substring(0, link.lastIndexOf("/"))
|
||||
|
||||
IntRange(1, pagesNumber).map { i ->
|
||||
|
||||
val pageLink = "$pageBase/chapterfun.ashx?cid=$chapterId&page=$i&key=$secretKey"
|
||||
|
||||
var responseText = ""
|
||||
|
||||
for (tr in 1..3) {
|
||||
|
||||
val request = Request.Builder()
|
||||
.url(pageLink)
|
||||
.addHeader("Referer", link)
|
||||
@ -302,7 +300,6 @@ class Mangahere : ParsedHttpSource() {
|
||||
}
|
||||
|
||||
private fun extractSecretKey(html: String, duktape: Duktape): String {
|
||||
|
||||
val secretKeyScriptLocation = html.indexOf("eval(function(p,a,c,k,e,d)")
|
||||
val secretKeyScriptEndLocation = html.indexOf("</script>", secretKeyScriptLocation)
|
||||
val secretKeyScript = html.substring(secretKeyScriptLocation, secretKeyScriptEndLocation).removePrefix("eval")
|
||||
|
@ -291,12 +291,9 @@ class Qiximh : HttpSource() {
|
||||
val document = response.asJsoup()
|
||||
|
||||
// Special thanks to author who created Mangahere.kt
|
||||
val duktape = Duktape.create()
|
||||
|
||||
val script = document.select("script:containsData(function(p,a,c,k,e,d))").html().removePrefix("eval")
|
||||
val deobfuscatedScript = duktape.evaluate(script).toString()
|
||||
val deobfuscatedScript = Duktape.create().use { it.evaluate(script).toString() }
|
||||
val urls = deobfuscatedScript.substringAfter("newImgs=[\"").substringBefore("\"]").split("\",\"")
|
||||
duktape.close()
|
||||
|
||||
return urls.mapIndexed { index, s -> Page(index, "", s) }
|
||||
}
|
||||
|
@ -131,7 +131,6 @@ class TencentComics : ParsedHttpSource() {
|
||||
"""
|
||||
|
||||
override fun pageListParse(document: Document): List<Page> {
|
||||
val duktape = Duktape.create()
|
||||
val pages = ArrayList<Page>()
|
||||
var html = document.html()
|
||||
|
||||
@ -145,7 +144,7 @@ class TencentComics : ParsedHttpSource() {
|
||||
|
||||
val raw = html.substringAfterLast("var DATA =").substringBefore("PRELOAD_NUM").trim().replace(Regex("^\'|\',$"), "")
|
||||
val decodePrefix = "var raw = \"$raw\"; var nonce = $nonce"
|
||||
val full = duktape.evaluate(decodePrefix + jsDecodeFunction).toString()
|
||||
val full = Duktape.create().use { it.evaluate(decodePrefix + jsDecodeFunction).toString() }
|
||||
val chapterData = json.parseToJsonElement(String(Base64.decode(full, Base64.DEFAULT))).jsonObject
|
||||
|
||||
if (!chapterData["chapter"]!!.jsonObject["canRead"]!!.jsonPrimitive.boolean) throw Exception("[此章节为付费内容]")
|
||||
|
Loading…
x
Reference in New Issue
Block a user