From e5c8bd9a2f8502f927a8e448b4f8021c76ef7d87 Mon Sep 17 00:00:00 2001 From: LagradOst <11805592+LagradOst@users.noreply.github.com> Date: Sat, 28 May 2022 17:03:49 +0200 Subject: [PATCH] updated key --- .../cloudstream3/extractors/Mcloud.kt | 2 +- .../cloudstream3/extractors/WcoStream.kt | 2 +- .../extractors/helper/WcoHelper.kt | 21 ++++++++++++++++--- docs/wcokey.txt | 1 - 4 files changed, 20 insertions(+), 6 deletions(-) delete mode 100644 docs/wcokey.txt diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/Mcloud.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/Mcloud.kt index b3c4b75b..d405cd0c 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/extractors/Mcloud.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/Mcloud.kt @@ -34,7 +34,7 @@ open class Mcloud : ExtractorApi() { private val key = "LCbu3iYC7ln24K7P" // key credits @Modder4869 override suspend fun getUrl(url: String, referer: String?): List? { val id = url.substringAfter("e/").substringAfter("embed/").substringBefore("?") - keytwo = getWcoKey() + keytwo = getWcoKey() ?: return null val encryptedid = encrypt(cipher(key, encrypt(id))).replace("/", "_").replace("=","") val link = "$mainUrl/info/$encryptedid" val response = app.get(link, headers = headers).text diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/WcoStream.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/WcoStream.kt index abd559d4..06349487 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/extractors/WcoStream.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/WcoStream.kt @@ -115,7 +115,7 @@ open class WcoStream : ExtractorApi() { )?.destructured) ?: return emptyList() // val (skey) = Regex("""skey\s=\s['"](.*?)['"];""").find(html)?.destructured // ?: return emptyList() - keytwo = getWcoKey() + keytwo = getWcoKey() ?: return emptyList() val encryptedID = encrypt(cipher(key, encrypt(Id))).replace("/", "_").replace("=","") val apiLink = "$baseUrl/info/$encryptedID" val referrer = "$baseUrl/e/$Id?domain=wcostream.cc" diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/helper/WcoHelper.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/helper/WcoHelper.kt index 5fb2524b..f14000c0 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/extractors/helper/WcoHelper.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/helper/WcoHelper.kt @@ -1,12 +1,27 @@ package com.lagradost.cloudstream3.extractors.helper +import com.fasterxml.jackson.annotation.JsonProperty import com.lagradost.cloudstream3.app class WcoHelper { companion object { - suspend fun getWcoKey(): String { - val i = app.get("https://raw.githubusercontent.com/LagradOst/CloudStream-3/master/docs/wcokey.txt").text - return i + data class ExternalKeys( + @JsonProperty("wco_key") + val wcoKey: String? = null, + ) + + private var keys: ExternalKeys? = null + private val wcoKey: String? get() = keys?.wcoKey + + private suspend fun getKeys() { + keys = keys + ?: app.get("https://raw.githubusercontent.com/LagradOst/CloudStream-3/master/docs/keys.json") + .parsedSafe() + } + + suspend fun getWcoKey(): String? { + getKeys() + return wcoKey } } } \ No newline at end of file diff --git a/docs/wcokey.txt b/docs/wcokey.txt deleted file mode 100644 index a3f3ecf6..00000000 --- a/docs/wcokey.txt +++ /dev/null @@ -1 +0,0 @@ -51wJ0FDq/UVCefLopEcmK3ni4WIQztMjZdSYOsbHr9R2h7PvxBGAuglaN8+kXT6y \ No newline at end of file