sora: fix extractors

This commit is contained in:
hexated 2023-12-20 14:52:09 +07:00
parent 4aa062b89f
commit 8f84b3a05d
3 changed files with 24 additions and 13 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 = 205 version = 206
android { android {
defaultConfig { defaultConfig {

View file

@ -323,18 +323,26 @@ open class Netembed : ExtractorApi() {
) { ) {
val response = app.get(url, referer = referer) val response = app.get(url, referer = referer)
val script = getAndUnpack(response.text) val script = getAndUnpack(response.text)
val m3u8 = Regex("((https:|http:)//.*\\.m3u8)").find(script)?.groupValues?.getOrNull(1) val m3u8 = Regex("((https:|http:)//.*\\.m3u8)").find(script)?.groupValues?.getOrNull(1) ?: return
if(m3u8.startsWith("https://www.febbox.com")) {
callback.invoke( callback.invoke(
ExtractorLink( ExtractorLink(
this.name, this.name,
this.name, this.name,
m3u8 ?: return, m3u8,
"$mainUrl/", "$mainUrl/",
getQuality(m3u8), getQuality(m3u8),
INFER_TYPE INFER_TYPE
) )
) )
} else {
M3u8Helper.generateM3u8(
this.name,
m3u8,
"$mainUrl/",
).forEach(callback)
}
} }
private suspend fun getQuality(url: String) : Int { private suspend fun getQuality(url: String) : Int {

View file

@ -14,6 +14,7 @@ import com.lagradost.nicehttp.RequestBodyTypes
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody.Companion.toRequestBody import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.internal.closeQuietly
import org.jsoup.Jsoup import org.jsoup.Jsoup
import org.jsoup.nodes.Document import org.jsoup.nodes.Document
import org.jsoup.select.Elements import org.jsoup.select.Elements
@ -2093,6 +2094,7 @@ object SoraExtractor : SoraStream() {
.substringBefore("-") .substringBefore("-")
} }
val res = app.get(fixUrl(iframe, api), verify = false) val res = app.get(fixUrl(iframe, api), verify = false)
delay(1000)
val serverUrl = res.document.selectFirst("script:containsData(pushState)")?.data()?.let { val serverUrl = res.document.selectFirst("script:containsData(pushState)")?.data()?.let {
""",\s*'([^']+)""".toRegex().find(it)?.groupValues?.get(1) """,\s*'([^']+)""".toRegex().find(it)?.groupValues?.get(1)
} ?: return } ?: return
@ -2147,8 +2149,9 @@ object SoraExtractor : SoraStream() {
"$blackvidAPI/v3/tv/sources/$tmdbId/$season/$episode?key=$key" "$blackvidAPI/v3/tv/sources/$tmdbId/$season/$episode?key=$key"
} }
val res = request(url).peekBody(1024 * 512) val res = request(url).body
val data = res.source().buffer.readByteArray().decrypt("2378f8e4e844f2dc839ab48f66e00acc2305a401") val bytes = res.bytes().also { res.closeQuietly() }
val data = bytes.decrypt("2378f8e4e844f2dc839ab48f66e00acc2305a401")
val json = tryParseJson<BlackvidResponses>(data) val json = tryParseJson<BlackvidResponses>(data)
json?.sources?.map { source -> json?.sources?.map { source ->