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 0421d66c..3f332480 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/extractors/Mcloud.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/Mcloud.kt @@ -7,6 +7,7 @@ import com.lagradost.cloudstream3.app import com.lagradost.cloudstream3.extractors.WcoStream.Companion.cipher import com.lagradost.cloudstream3.extractors.WcoStream.Companion.encrypt import com.lagradost.cloudstream3.extractors.WcoStream.Companion.keytwo +import com.lagradost.cloudstream3.extractors.helper.WcoHelper.Companion.getNewWcoKey import com.lagradost.cloudstream3.extractors.helper.WcoHelper.Companion.getWcoKey import com.lagradost.cloudstream3.utils.AppUtils.parseJson import com.lagradost.cloudstream3.utils.ExtractorApi @@ -34,11 +35,11 @@ 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("?") - val keys = getWcoKey() - keytwo = keys?.wcoKey ?: return null - val encryptedid = encrypt(cipher(keys.wcocipher!!, encrypt(id))).replace("/", "_").replace("=","") - val link = "$mainUrl/info/$encryptedid" - val response = app.get(link, headers = headers).text + val keys = getNewWcoKey() + keytwo = keys?.encryptKey ?: return null + val encryptedid = encrypt(cipher(keys.cipherkey!!, encrypt(id))).replace("/", "_").replace("=","") + val link = "$mainUrl/mediainfo/$encryptedid?key=${keys.mainKey}" + val response = app.get(link, referer = "https://animekisa.in/").text if(response.startsWith("")) { // TODO decrypt html for link return emptyList() 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 ccfa435c..0c9c6db7 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/extractors/WcoStream.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/WcoStream.kt @@ -3,6 +3,7 @@ package com.lagradost.cloudstream3.extractors import com.fasterxml.jackson.annotation.JsonProperty import com.lagradost.cloudstream3.apmap import com.lagradost.cloudstream3.app +import com.lagradost.cloudstream3.extractors.helper.WcoHelper.Companion.getNewWcoKey import com.lagradost.cloudstream3.extractors.helper.WcoHelper.Companion.getWcoKey import com.lagradost.cloudstream3.utils.ExtractorApi import com.lagradost.cloudstream3.utils.ExtractorLink @@ -115,10 +116,10 @@ open class WcoStream : ExtractorApi() { )?.destructured) ?: return emptyList() // val (skey) = Regex("""skey\s=\s['"](.*?)['"];""").find(html)?.destructured // ?: return emptyList() - val keys = getWcoKey() - keytwo = keys?.wcoKey ?: return emptyList() - val encryptedID = encrypt(cipher(keys.wcocipher!!, encrypt(Id))).replace("/", "_").replace("=","") - val apiLink = "$baseUrl/info/$encryptedID" + val keys = getNewWcoKey() + keytwo = keys?.encryptKey ?: return emptyList() + val encryptedID = encrypt(cipher(keys.cipherkey!!, encrypt(Id))).replace("/", "_").replace("=","") + val apiLink = "$baseUrl/mediainfo/$encryptedID?key=${keys.mainKey}" val referrer = "$baseUrl/e/$Id?domain=wcostream.cc" data class SourcesWco ( 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 9f303148..a11e720a 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 @@ -15,7 +15,18 @@ class WcoHelper { @JsonProperty("wco_cipher_key") val wcocipher: String? = null ) + + data class NewExternalKeys( + @JsonProperty("cipherKey") + val cipherkey: String? = null, + @JsonProperty("encryptKey") + val encryptKey: String? = null, + @JsonProperty("mainKey") + val mainKey: String? = null, + ) + private var keys: ExternalKeys? = null + private var newKeys: NewExternalKeys? = null private suspend fun getKeys() { keys = keys ?: app.get("https://raw.githubusercontent.com/LagradOst/CloudStream-3/master/docs/keys.json") @@ -28,5 +39,18 @@ class WcoHelper { getKeys() return keys } + + private suspend fun getNewKeys() { + newKeys = newKeys + ?: app.get("https://raw.githubusercontent.com/chekaslowakiya/BruhFlow/main/keys.json") + .parsedSafe()?.also { setKey(BACKUP_KEY_DATA, it) } ?: getKey( + BACKUP_KEY_DATA + ) + } + + suspend fun getNewWcoKey(): NewExternalKeys? { + getNewKeys() + return newKeys + } } } \ No newline at end of file