mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
stremioX: fix source name
This commit is contained in:
parent
f5612b146b
commit
99f2d9d67d
3 changed files with 25 additions and 28 deletions
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 7
|
||||
version = 8
|
||||
|
||||
|
||||
cloudstream {
|
||||
|
|
|
@ -69,7 +69,7 @@ class StremioC : MainAPI() {
|
|||
if (request.isSuccessful) {
|
||||
val res = tryParseJson<StreamsResponse>(request.text) ?: return false
|
||||
res.streams.forEach { stream ->
|
||||
stream.runCallback(this, subtitleCallback, callback)
|
||||
stream.runCallback(subtitleCallback, callback)
|
||||
}
|
||||
} else {
|
||||
argamap(
|
||||
|
@ -112,7 +112,7 @@ class StremioC : MainAPI() {
|
|||
tryParseJson<StreamsResponse>(app.get("${site.url.fixSourceUrl()}/stream/${type}/${id}.json").text)
|
||||
?: return@apmap
|
||||
res.streams.forEach { stream ->
|
||||
stream.runCallback(this, subtitleCallback, callback)
|
||||
stream.runCallback(subtitleCallback, callback)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -283,6 +283,13 @@ class StremioC : MainAPI() {
|
|||
val id: String?,
|
||||
)
|
||||
|
||||
private data class ProxyHeaders(
|
||||
val request: Map<String,String>?,
|
||||
)
|
||||
|
||||
private data class BehaviorHints(
|
||||
val proxyHeaders: ProxyHeaders?,
|
||||
)
|
||||
private data class Stream(
|
||||
val name: String?,
|
||||
val title: String?,
|
||||
|
@ -290,34 +297,24 @@ class StremioC : MainAPI() {
|
|||
val description: String?,
|
||||
val ytId: String?,
|
||||
val externalUrl: String?,
|
||||
val behaviorHints: JSONObject?,
|
||||
val behaviorHints: BehaviorHints?,
|
||||
val infoHash: String?,
|
||||
val sources: List<String> = emptyList(),
|
||||
val subtitles: List<Subtitle> = emptyList()
|
||||
) {
|
||||
suspend fun runCallback(
|
||||
provider: StremioC,
|
||||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit
|
||||
) {
|
||||
if (url != null) {
|
||||
var referer: String? = null
|
||||
try {
|
||||
val headers = ((behaviorHints?.get("proxyHeaders") as? JSONObject)
|
||||
?.get("request") as? JSONObject)
|
||||
referer =
|
||||
headers?.get("referer") as? String ?: headers?.get("origin") as? String
|
||||
} catch (ex: Throwable) {
|
||||
Log.e("Stremio", Log.getStackTraceString(ex))
|
||||
}
|
||||
callback.invoke(
|
||||
ExtractorLink(
|
||||
name ?: "",
|
||||
title ?: name ?: "",
|
||||
fixRDSourceName(name, title),
|
||||
url,
|
||||
if (provider.mainUrl.contains("kisskh")) "https://kisskh.me/" else referer
|
||||
?: "",
|
||||
"",
|
||||
getQualityFromName(description),
|
||||
headers = behaviorHints?.proxyHeaders?.request ?: mapOf(),
|
||||
isM3u8 = URI(url).path.endsWith(".m3u8")
|
||||
)
|
||||
)
|
||||
|
|
|
@ -254,6 +254,14 @@ open class StremioX : MainAPI() {
|
|||
val id: String?,
|
||||
)
|
||||
|
||||
private data class ProxyHeaders(
|
||||
val request: Map<String,String>?,
|
||||
)
|
||||
|
||||
private data class BehaviorHints(
|
||||
val proxyHeaders: ProxyHeaders?,
|
||||
)
|
||||
|
||||
private data class Stream(
|
||||
val name: String?,
|
||||
val title: String?,
|
||||
|
@ -261,7 +269,7 @@ open class StremioX : MainAPI() {
|
|||
val description: String?,
|
||||
val ytId: String?,
|
||||
val externalUrl: String?,
|
||||
val behaviorHints: JSONObject?,
|
||||
val behaviorHints: BehaviorHints?,
|
||||
val infoHash: String?,
|
||||
val sources: List<String> = emptyList(),
|
||||
val subtitles: List<Subtitle> = emptyList()
|
||||
|
@ -271,22 +279,14 @@ open class StremioX : MainAPI() {
|
|||
callback: (ExtractorLink) -> Unit
|
||||
) {
|
||||
if (url != null) {
|
||||
var referer: String? = null
|
||||
try {
|
||||
val headers = ((behaviorHints?.get("proxyHeaders") as? JSONObject)
|
||||
?.get("request") as? JSONObject)
|
||||
referer =
|
||||
headers?.get("referer") as? String ?: headers?.get("origin") as? String
|
||||
} catch (ex: Throwable) {
|
||||
Log.e("Stremio", Log.getStackTraceString(ex))
|
||||
}
|
||||
callback.invoke(
|
||||
ExtractorLink(
|
||||
name ?: "",
|
||||
fixRDSourceName(name, title),
|
||||
url,
|
||||
referer ?: "",
|
||||
"",
|
||||
getQualityFromName(description),
|
||||
headers = behaviorHints?.proxyHeaders?.request ?: mapOf(),
|
||||
isM3u8 = URI(url).path.endsWith(".m3u8")
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue