wco changes (#1140)

* wco changes

* typo
This commit is contained in:
Stormunblessed 2022-06-07 10:57:11 +00:00 committed by GitHub
parent 97bee668e3
commit 941faf7b5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 9 deletions

View File

@ -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<ExtractorLink>? {
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("<!DOCTYPE html>")) {
// TODO decrypt html for link
return emptyList()

View File

@ -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 (

View File

@ -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<NewExternalKeys>()?.also { setKey(BACKUP_KEY_DATA, it) } ?: getKey(
BACKUP_KEY_DATA
)
}
suspend fun getNewWcoKey(): NewExternalKeys? {
getNewKeys()
return newKeys
}
}
}