SussyToons: Fix memory leak (#8240)

* Fix memory leak

* Remove variable
This commit is contained in:
Chopper 2025-03-27 17:08:48 -03:00 committed by Draff
parent fa09f8122d
commit 09d9b33080
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
2 changed files with 7 additions and 6 deletions

View File

@ -1,7 +1,7 @@
ext {
extName = 'Sussy Toons'
extClass = '.SussyToons'
extVersionCode = 52
extVersionCode = 53
isNsfw = true
}

View File

@ -309,20 +309,21 @@ class SussyToons : HttpSource(), ConfigurableSource {
// ============================= Utilities ====================================
private fun Response.parseScriptToJson(): String? {
val quickJs = QuickJs.create()
val document = asJsoup()
val script = document.select("script")
.map(Element::data)
.filter(String::isNotEmpty)
.joinToString("\n")
val content = quickJs.evaluate(
"""
val content = QuickJs.create().use {
it.evaluate(
"""
globalThis.self = globalThis;
$script
self.__next_f.map(it => it[it.length - 1]).join('')
""".trimIndent(),
) as String
""".trimIndent(),
) as String
}
return PAGE_JSON_REGEX.find(content)?.groups?.get(0)?.value
}