From e2411e029fffa1c8f3866d2f15bb48f80235acad Mon Sep 17 00:00:00 2001 From: phisher98 Date: Fri, 3 May 2024 08:43:53 +0530 Subject: [PATCH] Update --- .../com/lagradost/cloudstream3/extractors/Chillx.kt | 12 ++++-------- 1 file changed, 4 insertions(+), 8 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 3a11e874..1ada4d61 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/extractors/Chillx.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/Chillx.kt @@ -22,13 +22,12 @@ class Watchx : Chillx() { override val mainUrl = "https://watchx.top" } - -@Suppress("NAME_SHADOWING") open class Chillx : ExtractorApi() { override val name = "Chillx" override val mainUrl = "https://chillx.top" override val requiresReferer = true + @Suppress("NAME_SHADOWING") override suspend fun getUrl( url: String, referer: String?, @@ -41,7 +40,7 @@ open class Chillx : ExtractorApi() { referer = url, ).text )?.groupValues?.get(1) - val decrypt = cryptoAESHandler(master ?: "",key.toByteArray(), false)?.replace("\\", "") ?: throw ErrorLoadingException("failed to decrypt") + val decrypt = cryptoAESHandler(master ?: "",fetchKey().toByteArray(), false)?.replace("\\", "") ?: throw ErrorLoadingException("failed to decrypt") val source = Regex(""""?file"?:\s*"([^"]+)""").find(decrypt)?.groupValues?.get(1) val subtitles = Regex("""subtitle"?:\s*"([^"]+)""").find(decrypt)?.groupValues?.get(1) val subtitlePattern = """\[(.*?)](https?://[^\s,]+)""".toRegex() @@ -84,11 +83,8 @@ open class Chillx : ExtractorApi() { } } - private var key: String? = null - val key = fetchKey() ?: throw ErrorLoadingException("Unable to get key") - - private suspend fun fetchKey(): String? { - return app.get("https://raw.githubusercontent.com/rushi-chavan/multi-keys/keys/keys.json").parsedSafe()?.key?.get(0)?.also { key = it } + private suspend fun fetchKey(): String { + return app.get("https://raw.githubusercontent.com/rushi-chavan/multi-keys/keys/keys.json").parsedSafe()?.key?.get(0) ?: throw ErrorLoadingException("Unable to get key") } data class Keys(