sora: fi sources

This commit is contained in:
Olivia 2024-02-02 16:11:50 +07:00
parent 2ea2bbb035
commit c57f60275d
2 changed files with 28 additions and 7 deletions

View file

@ -1,7 +1,7 @@
import org.jetbrains.kotlin.konan.properties.Properties import org.jetbrains.kotlin.konan.properties.Properties
// use an integer for version numbers // use an integer for version numbers
version = 221 version = 222
android { android {
defaultConfig { defaultConfig {

View file

@ -218,10 +218,29 @@ object SoraExtractor : SoraStream() {
val req = app.get(url) val req = app.get(url)
val directUrl = getBaseUrl(req.url) val directUrl = getBaseUrl(req.url)
req.document.select("ul.bx-lst.aa-tbs li a").apmap { 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") val iframe = app.get(base64Decode(it.attr("data-src"))).document.selectFirst("iframe")
?.attr("src") ?.attr("src") ?: return@apmap
loadExtractor(iframe ?: return@apmap, "$directUrl/", subtitleCallback, callback) 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, cookies = cookies,
referer = url, referer = url,
headers = headers 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 server = el.attr("data-value")
val encryptedData = app.get( val encryptedData = app.get(
"$url?server=$server&_=$unixTimeMS", "$url?server=$server&_=$unixTimeMS",
@ -2120,7 +2141,7 @@ object SoraExtractor : SoraStream() {
referer = url, referer = url,
headers = headers headers = headers
).text ).text
val links = encryptedData.decrypt(base64Decode("OTg=")) val links = encryptedData.decrypt(key)
links?.forEach { video -> links?.forEach { video ->
qualities.filter { it <= video.max.toInt() }.forEach { qualities.filter { it <= video.max.toInt() }.forEach {
callback( callback(