From c57f60275d3a2302f3ec06a6e2a8531fd01e4624 Mon Sep 17 00:00:00 2001 From: Olivia Date: Fri, 2 Feb 2024 16:11:50 +0700 Subject: [PATCH] sora: fi sources --- SoraStream/build.gradle.kts | 2 +- .../main/kotlin/com/hexated/SoraExtractor.kt | 33 +++++++++++++++---- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/SoraStream/build.gradle.kts b/SoraStream/build.gradle.kts index 367225c30..334cb5c4a 100644 --- a/SoraStream/build.gradle.kts +++ b/SoraStream/build.gradle.kts @@ -1,7 +1,7 @@ import org.jetbrains.kotlin.konan.properties.Properties // use an integer for version numbers -version = 221 +version = 222 android { defaultConfig { diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt b/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt index 8b0ef0084..d8ef6a060 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt @@ -218,10 +218,29 @@ object SoraExtractor : SoraStream() { val req = app.get(url) val directUrl = getBaseUrl(req.url) req.document.select("ul.bx-lst.aa-tbs li a").apmap { - if(!it.select("span.option").text().startsWith("Gdmirrorbot")) return@apmap val iframe = app.get(base64Decode(it.attr("data-src"))).document.selectFirst("iframe") - ?.attr("src") - loadExtractor(iframe ?: return@apmap, "$directUrl/", subtitleCallback, callback) + ?.attr("src") ?: return@apmap + loadExtractor(iframe, "$directUrl/", subtitleCallback) { link -> + when { + link.name == "Bestx" && link.quality == Qualities.Unknown.value -> { + callback.invoke( + ExtractorLink( + "Moviefiction", + "Moviefiction", + link.url, + link.referer, + Qualities.P1080.value, + link.type, + link.headers, + link.extractorData + ) + ) + } + link.name != "Bestx" -> { + callback.invoke(link) + } + } + } } } @@ -2111,8 +2130,10 @@ object SoraExtractor : SoraStream() { cookies = cookies, referer = url, headers = headers - ).document - serverRes.select("ul li").apmap { el -> + ) + val script = getAndUnpack(serverRes.text) + val key = """\(key\s*=\s*(\d+)\)""".toRegex().find(script)?.groupValues?.get(1) ?: return + serverRes.document.select("ul li").apmap { el -> val server = el.attr("data-value") val encryptedData = app.get( "$url?server=$server&_=$unixTimeMS", @@ -2120,7 +2141,7 @@ object SoraExtractor : SoraStream() { referer = url, headers = headers ).text - val links = encryptedData.decrypt(base64Decode("OTg=")) + val links = encryptedData.decrypt(key) links?.forEach { video -> qualities.filter { it <= video.max.toInt() }.forEach { callback(