This commit is contained in:
hexated 2023-02-19 18:46:38 +07:00
parent 9b6db07b7f
commit 58738aacc1
2 changed files with 4 additions and 5 deletions

View file

@ -1,6 +1,5 @@
package com.hexated package com.hexated
import android.util.Log
import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.utils.* import com.lagradost.cloudstream3.utils.*
@ -2446,7 +2445,7 @@ object SoraExtractor : SoraStream() {
val res = app.get(fixUrl(iframe, gomoviesAPI), verify = false) val res = app.get(fixUrl(iframe, gomoviesAPI), verify = false)
val match = "var url = '(/user/servers/.*?\\?ep=.*?)';".toRegex().find(res.text) val match = "var url = '(/user/servers/.*?\\?ep=.*?)';".toRegex().find(res.text)
val serverUrl = match?.groupValues?.get(1) ?: return val serverUrl = match?.groupValues?.get(1) ?: return
val cookies = res.okhttpResponse.headers.getPutlockerCookies() val cookies = res.okhttpResponse.headers.getGomoviesCookies()
val url = res.document.select("meta[property=og:url]").attr("content") val url = res.document.select("meta[property=og:url]").attr("content")
val headers = mapOf("X-Requested-With" to "XMLHttpRequest") val headers = mapOf("X-Requested-With" to "XMLHttpRequest")
val qualities = intArrayOf(2160, 1440, 1080, 720, 480, 360) val qualities = intArrayOf(2160, 1440, 1080, 720, 480, 360)
@ -2461,7 +2460,7 @@ object SoraExtractor : SoraStream() {
referer = url, referer = url,
headers = headers headers = headers
).text ).text
val json = base64Decode(encryptedData).putlockerDecrypt() val json = base64Decode(encryptedData).decryptGomoviesJson()
val links = tryParseJson<List<GomoviesSources>>(json) ?: return@amap val links = tryParseJson<List<GomoviesSources>>(json) ?: return@amap
links.forEach { video -> links.forEach { video ->
qualities.filter { it <= video.max.toInt() }.forEach { qualities.filter { it <= video.max.toInt() }.forEach {

View file

@ -729,7 +729,7 @@ fun decodeIndexJson(json: String): String {
/** taken from https://github.com/821938089/cloudstream-extensions/blob/23dae833a48fb329d4c67dd77ac1e8bb592ac5a9/Movie123Provider/src/main/kotlin/com/horis/cloudstreamplugins/Movie123Provider.kt#L138-L150 /** taken from https://github.com/821938089/cloudstream-extensions/blob/23dae833a48fb329d4c67dd77ac1e8bb592ac5a9/Movie123Provider/src/main/kotlin/com/horis/cloudstreamplugins/Movie123Provider.kt#L138-L150
- Credits to Horis - Credits to Horis
**/ **/
fun String.putlockerDecrypt(key: String = "123"): String { fun String.decryptGomoviesJson(key: String = "123"): String {
val sb = StringBuilder() val sb = StringBuilder()
var i = 0 var i = 0
while (i < this.length) { while (i < this.length) {
@ -743,7 +743,7 @@ fun String.putlockerDecrypt(key: String = "123"): String {
return sb.toString() return sb.toString()
} }
fun Headers.getPutlockerCookies(cookieKey: String = "set-cookie"): Map<String, String> { fun Headers.getGomoviesCookies(cookieKey: String = "set-cookie"): Map<String, String> {
val cookieList = val cookieList =
this.filter { it.first.equals(cookieKey, ignoreCase = true) }.mapNotNull { this.filter { it.first.equals(cookieKey, ignoreCase = true) }.mapNotNull {
it.second.split(";").firstOrNull() it.second.split(";").firstOrNull()