diff --git a/app/src/main/java/com/lagradost/cloudstream3/animeproviders/GogoanimeProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/animeproviders/GogoanimeProvider.kt index 2babde53..13d0e587 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/animeproviders/GogoanimeProvider.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/animeproviders/GogoanimeProvider.kt @@ -61,20 +61,22 @@ class GogoanimeProvider : MainAPI() { * @param mainApiName used for ExtractorLink names and source * @param iv secret iv from site, required non-null * @param secretKey secret key for decryption from site, required non-null + * @param secretDecryptKey secret key to decrypt the response json, required non-null * */ suspend fun extractVidstream( iframeUrl: String, mainApiName: String, callback: (ExtractorLink) -> Unit, iv: ByteArray?, - secretKey: ByteArray? + secretKey: ByteArray?, + secretDecryptKey: ByteArray? ) = safeApiCall { // https://github.com/saikou-app/saikou/blob/3e756bd8e876ad7a9318b17110526880525a5cd3/app/src/main/java/ani/saikou/anime/source/extractors/GogoCDN.kt // No Licence on the following code // Also modified of https://github.com/jmir1/aniyomi-extensions/blob/master/src/en/gogoanime/src/eu/kanade/tachiyomi/animeextension/en/gogoanime/extractors/GogoCdnExtractor.kt // License on the code above https://github.com/jmir1/aniyomi-extensions/blob/master/LICENSE - if (iv == null || secretKey == null) + if (iv == null || secretKey == null || secretDecryptKey == null) return@safeApiCall val uri = URI(iframeUrl) @@ -84,12 +86,12 @@ class GogoanimeProvider : MainAPI() { val encryptedId = cryptoHandler(id, iv, secretKey) val jsonResponse = app.get( - "$mainUrl/encrypt-ajax.php?id=$encryptedId", + "$mainUrl/encrypt-ajax.php?id=$encryptedId&alias=$id", headers = mapOf("X-Requested-With" to "XMLHttpRequest") ) val dataencrypted = jsonResponse.text.substringAfter("{\"data\":\"").substringBefore("\"}") - val datadecrypted = cryptoHandler(dataencrypted, iv, secretKey, false) + val datadecrypted = cryptoHandler(dataencrypted, iv, secretDecryptKey, false) val sources = AppUtils.parseJson(datadecrypted) fun invokeGogoSource( @@ -370,10 +372,12 @@ class GogoanimeProvider : MainAPI() { loadExtractor(data, streamingResponse.url, callback) } }, { - val iv = "4786443969418267".toByteArray() + val iv = "8244002440089157".toByteArray() val secretKey = - "63976882873536819639922083275907".toByteArray() - extractVidstream(iframe, this.name, callback, iv, secretKey) + "93106165734640459728346589106791".toByteArray() + val secretDecryptKey = + "97952160493714852094564712118349".toByteArray() + extractVidstream(iframe, this.name, callback, iv, secretKey, secretDecryptKey) }) } ) diff --git a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/DramaSeeProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/DramaSeeProvider.kt index b37c2c92..994b4915 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/DramaSeeProvider.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/DramaSeeProvider.kt @@ -199,7 +199,7 @@ class DramaSeeProvider : MainAPI() { url.startsWith("https://asianembed.io") || url.startsWith("https://asianload.io") -> { val iv = "9262859232435825".toByteArray() val secretKey = "93422192433952489752342908585752".toByteArray() - extractVidstream(url, this.name, callback, iv, secretKey) + extractVidstream(url, this.name, callback, iv, secretKey, secretKey) AsianEmbedHelper.getUrls(url, callback) } url.startsWith("https://embedsito.com") -> { diff --git a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/VidstreamProviderTemplate.kt b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/VidstreamProviderTemplate.kt index 4715e54f..866ad4e6 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/VidstreamProviderTemplate.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/VidstreamProviderTemplate.kt @@ -20,8 +20,53 @@ open class VidstreamProviderTemplate : MainAPI() { * Try keys from other providers before cracking * one yourself. * */ + // Userscript to get the keys: + + /* + // ==UserScript== + // @name Easy keys + // @namespace Violentmonkey Scripts + // @match https://*/streaming.php* + // @grant none + // @version 1.0 + // @author LagradOst + // @description 4/16/2022, 2:05:31 PM + // ==/UserScript== + + let encrypt = CryptoJS.AES.encrypt; + CryptoJS.AES.encrypt = (message, key, cfg) => { + let realKey = CryptoJS.enc.Utf8.stringify(key); + let realIv = CryptoJS.enc.Utf8.stringify(cfg.iv); + + var result = encrypt(message, key, cfg); + let realResult = CryptoJS.enc.Utf8.stringify(result); + + popup = "Encrypt key: " + realKey + "\n\nIV: " + realIv + "\n\nMessage: " + message + "\n\nResult: " + realResult; + alert(popup); + + return result; + }; + + let decrypt = CryptoJS.AES.decrypt; + CryptoJS.AES.decrypt = (message, key, cfg) => { + let realKey = CryptoJS.enc.Utf8.stringify(key); + let realIv = CryptoJS.enc.Utf8.stringify(cfg.iv); + + let result = decrypt(message, key, cfg); + let realResult = CryptoJS.enc.Utf8.stringify(result); + + popup = "Decrypt key: " + realKey + "\n\nIV: " + realIv + "\n\nMessage: " + message + "\n\nResult: " + realResult; + alert(popup); + + return result; + }; + + */ + */ + open val iv: ByteArray? = null open val secretKey: ByteArray? = null + open val secretDecryptKey: ByteArray? = null // // mainUrl is good to have as a holder for the url to make future changes easier. // override val mainUrl: String @@ -207,7 +252,7 @@ open class VidstreamProviderTemplate : MainAPI() { val iframeLink = Jsoup.parse(app.get(data).text).selectFirst("iframe")?.attr("src") ?: return false - extractVidstream(iframeLink, this.name, callback, iv, secretKey) + extractVidstream(iframeLink, this.name, callback, iv, secretKey, secretDecryptKey) // In this case the video player is a vidstream clone and can be handled by the vidstream extractor. // This case is a both unorthodox and you normally do not call extractors as they detect the url returned and does the rest. val vidstreamObject = Vidstream(vidstreamExtractorUrl ?: mainUrl) diff --git a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/WatchAsianProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/WatchAsianProvider.kt index 5e392ec9..f9791473 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/WatchAsianProvider.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/WatchAsianProvider.kt @@ -216,7 +216,7 @@ class WatchAsianProvider : MainAPI() { url.startsWith("https://asianembed.io") || url.startsWith("https://asianload.io") -> { val iv = "9262859232435825".toByteArray() val secretKey = "93422192433952489752342908585752".toByteArray() - extractVidstream(url, this.name, callback, iv, secretKey) + extractVidstream(url, this.name, callback, iv, secretKey, secretKey) AsianEmbedHelper.getUrls(url, callback) } url.startsWith("https://embedsito.com") -> {