This commit is contained in:
hexated 2023-09-10 21:21:50 +07:00
parent 18c07cc069
commit 67896f1d69
1 changed files with 7 additions and 3 deletions

View File

@ -2206,6 +2206,9 @@ object SoraExtractor : SoraStream() {
episode: Int? = null, episode: Int? = null,
callback: (ExtractorLink) -> Unit, callback: (ExtractorLink) -> Unit,
) { ) {
fun String.decrypt(key: String) : List<PrimewireSources>? {
return tryParseJson<List<PrimewireSources>>(base64Decode(this).decodePrimewireXor(key))
}
val slug = getEpisodeSlug(season, episode) val slug = getEpisodeSlug(season, episode)
val query = if (season == null) { val query = if (season == null) {
title title
@ -2260,7 +2263,9 @@ object SoraExtractor : SoraStream() {
"$primewireAPI$serverUrl", "$primewireAPI$serverUrl",
cookies = cookies, referer = url, headers = headers cookies = cookies, referer = url, headers = headers
) )
val key = getAndUnpack(serverRes.text).substringAfter("(key=").substringBefore(")") val unpack = getAndUnpack(serverRes.text)
val key = unpack.substringAfter("(key=").substringBefore(")")
val key2 = unpack.substringAfter("<\"").substringBefore("\".")
serverRes.document.select("ul li").amap { el -> serverRes.document.select("ul li").amap { el ->
val server = el.attr("data-value") val server = el.attr("data-value")
val encryptedData = app.get( val encryptedData = app.get(
@ -2269,8 +2274,7 @@ object SoraExtractor : SoraStream() {
referer = url, referer = url,
headers = headers headers = headers
).text ).text
val json = base64Decode(encryptedData).decodePrimewireXor(key) val links = encryptedData.decrypt(key) ?: encryptedData.decrypt(key2) ?: return@amap
val links = tryParseJson<List<PrimewireSources>>(json) ?: return@amap
links.forEach { video -> links.forEach { video ->
qualities.filter { it <= video.max.toInt() }.forEach { qualities.filter { it <= video.max.toInt() }.forEach {
callback( callback(