This commit is contained in:
phisher98 2024-05-03 08:43:53 +05:30
parent f803219c99
commit e2411e029f
1 changed files with 4 additions and 8 deletions

View File

@ -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<Keys>()?.key?.get(0) ?: throw ErrorLoadingException("Unable to get key")
}
data class Keys(