Skip to content

Commit

Permalink
sora: fix extractors
Browse files Browse the repository at this point in the history
  • Loading branch information
hexated committed Dec 20, 2023
1 parent 4aa062b commit 8f84b3a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
2 changes: 1 addition & 1 deletion SoraStream/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.jetbrains.kotlin.konan.properties.Properties

// use an integer for version numbers
version = 205
version = 206

android {
defaultConfig {
Expand Down
28 changes: 18 additions & 10 deletions SoraStream/src/main/kotlin/com/hexated/Extractors.kt
Original file line number Diff line number Diff line change
Expand Up @@ -323,18 +323,26 @@ open class Netembed : ExtractorApi() {
) {
val response = app.get(url, referer = referer)
val script = getAndUnpack(response.text)
val m3u8 = Regex("((https:|http:)//.*\\.m3u8)").find(script)?.groupValues?.getOrNull(1)

callback.invoke(
ExtractorLink(
this.name,
val m3u8 = Regex("((https:|http:)//.*\\.m3u8)").find(script)?.groupValues?.getOrNull(1) ?: return

if(m3u8.startsWith("https://www.febbox.com")) {
callback.invoke(
ExtractorLink(
this.name,
this.name,
m3u8,
"$mainUrl/",
getQuality(m3u8),
INFER_TYPE
)
)
} else {
M3u8Helper.generateM3u8(
this.name,
m3u8 ?: return,
m3u8,
"$mainUrl/",
getQuality(m3u8),
INFER_TYPE
)
)
).forEach(callback)
}
}

private suspend fun getQuality(url: String) : Int {
Expand Down
7 changes: 5 additions & 2 deletions SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import com.lagradost.nicehttp.RequestBodyTypes
import kotlinx.coroutines.delay
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.internal.closeQuietly
import org.jsoup.Jsoup
import org.jsoup.nodes.Document
import org.jsoup.select.Elements
Expand Down Expand Up @@ -2093,6 +2094,7 @@ object SoraExtractor : SoraStream() {
.substringBefore("-")
}
val res = app.get(fixUrl(iframe, api), verify = false)
delay(1000)
val serverUrl = res.document.selectFirst("script:containsData(pushState)")?.data()?.let {
""",\s*'([^']+)""".toRegex().find(it)?.groupValues?.get(1)
} ?: return
Expand Down Expand Up @@ -2147,8 +2149,9 @@ object SoraExtractor : SoraStream() {
"$blackvidAPI/v3/tv/sources/$tmdbId/$season/$episode?key=$key"
}

val res = request(url).peekBody(1024 * 512)
val data = res.source().buffer.readByteArray().decrypt("2378f8e4e844f2dc839ab48f66e00acc2305a401")
val res = request(url).body
val bytes = res.bytes().also { res.closeQuietly() }
val data = bytes.decrypt("2378f8e4e844f2dc839ab48f66e00acc2305a401")
val json = tryParseJson<BlackvidResponses>(data)

json?.sources?.map { source ->
Expand Down

0 comments on commit 8f84b3a

Please sign in to comment.