This commit is contained in:
hexated 2023-09-11 18:34:11 +07:00
parent 6cdeb65922
commit c6f89db48a
3 changed files with 15 additions and 1 deletions

View File

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

View File

@ -1100,7 +1100,9 @@ object SoraExtractor : SoraStream() {
val driveReq = app.get(driveLink)
val driveRes = driveReq.document
val bitLink = driveRes.select("a.btn.btn-outline-success").attr("href")
val insLink = driveRes.select("a.btn.btn-danger:contains(Instant Download)").attr("href")
val downloadLink = when {
insLink.isNotEmpty() -> extractInstantUHD(insLink)
driveRes.select("button.btn.btn-success").text()
.contains("Direct Download", true) -> extractDirectUHD(driveLink, driveReq)
bitLink.isNullOrEmpty() -> {

View File

@ -163,6 +163,18 @@ suspend fun extractMirrorUHD(url: String, ref: String): String? {
)
}
suspend fun extractInstantUHD(url: String): String? {
val host = getBaseUrl(url)
val body = FormBody.Builder()
.addEncoded("keys", url.substringAfter("url="))
.build()
return app.post(
"$host/api", requestBody = body, headers = mapOf(
"x-token" to "${url.toUri().host}"
), referer = "$host/"
).parsedSafe<Map<String, String>>()?.get("url")
}
suspend fun extractDirectUHD(url: String, niceResponse: NiceResponse): String? {
val document = niceResponse.document
val script = document.selectFirst("script:containsData(cf_token)")?.data() ?: return null