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 { ext {
extName = 'Sussy Toons' extName = 'Sussy Toons'
extClass = '.SussyToons' extClass = '.SussyToons'
extVersionCode = 52 extVersionCode = 53
isNsfw = true isNsfw = true
} }

View File

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