From 76c066e6e6dac149688f24cac1e41e37cdc56430 Mon Sep 17 00:00:00 2001 From: Sofie99 Date: Mon, 11 Dec 2023 12:23:53 +0700 Subject: [PATCH] fix Chillx key --- .../com/lagradost/cloudstream3/extractors/Chillx.kt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/Chillx.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/Chillx.kt index cb234c5c..68d543d3 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/extractors/Chillx.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/Chillx.kt @@ -28,10 +28,7 @@ open class Chillx : ExtractorApi() { override val name = "Chillx" override val mainUrl = "https://chillx.top" override val requiresReferer = true - - companion object { - private const val KEY = "tSIsE8FgpRkv3QQQ" - } + private var key: String? = null override suspend fun getUrl( url: String, @@ -49,7 +46,7 @@ open class Chillx : ExtractorApi() { ) ).text )?.groupValues?.get(1) - val decrypt = cryptoAESHandler(master ?: return, KEY.toByteArray(), false)?.replace("\\", "") ?: throw ErrorLoadingException("failed to decrypt") + val decrypt = cryptoAESHandler(master ?: return, getKey().toByteArray(), false)?.replace("\\", "") ?: throw ErrorLoadingException("failed to decrypt") val source = Regex(""""?file"?:\s*"([^"]+)""").find(decrypt)?.groupValues?.get(1) val tracks = Regex("""tracks:\s*\[(.+)]""").find(decrypt)?.groupValues?.get(1) @@ -82,6 +79,12 @@ open class Chillx : ExtractorApi() { } } + suspend fun getKey() = key ?: fetchKey().also { key = it } + + private suspend fun fetchKey(): String { + return app.get("https://raw.githubusercontent.com/Sofie99/Resources/main/chillix_key.json").parsed() + } + data class Tracks( @JsonProperty("file") val file: String? = null, @JsonProperty("label") val label: String? = null,