small sources fix SoraStream

This commit is contained in:
hexated 2022-10-17 10:47:46 +07:00
parent 30381c95f6
commit 5b6b80b1f0
2 changed files with 35 additions and 27 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 2 version = 3
cloudstream { cloudstream {

View file

@ -4,6 +4,7 @@ import android.util.Log
import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.metaproviders.TmdbProvider import com.lagradost.cloudstream3.metaproviders.TmdbProvider
import com.lagradost.cloudstream3.mvvm.safeApiCall
import com.lagradost.cloudstream3.utils.AppUtils import com.lagradost.cloudstream3.utils.AppUtils
import com.lagradost.cloudstream3.utils.AppUtils.parseJson import com.lagradost.cloudstream3.utils.AppUtils.parseJson
import com.lagradost.cloudstream3.utils.AppUtils.toJson import com.lagradost.cloudstream3.utils.AppUtils.toJson
@ -277,33 +278,40 @@ class SoraStream : TmdbProvider() {
referer = referer referer = referer
).parsedSafe<LoadLinks>() ).parsedSafe<LoadLinks>()
if (json?.sources.isNullOrEmpty()) { argamap(
// invokeTwoEmbed(res.id, res.season, res.episode, subtitleCallback, callback) {
invokeLocalSources(referer, subtitleCallback, callback) invokeTwoEmbed(res.id, res.season, res.episode, subtitleCallback, callback)
} else { },
json?.sources?.map { source -> {
callback.invoke( if (json?.sources.isNullOrEmpty()) {
ExtractorLink( invokeLocalSources(referer, subtitleCallback, callback)
this.name, } else {
this.name, json?.sources?.map { source ->
source.url ?: return@map null, callback.invoke(
"$mainServerAPI/", ExtractorLink(
source.quality?.toIntOrNull() ?: Qualities.Unknown.value, this.name,
isM3u8 = source.isM3U8, this.name,
headers = mapOf("Origin" to mainServerAPI) source.url ?: return@map null,
) "$mainServerAPI/",
) source.quality?.toIntOrNull() ?: Qualities.Unknown.value,
} isM3u8 = source.isM3U8,
headers = mapOf("Origin" to mainServerAPI)
)
)
}
json?.subtitles?.map { sub ->
subtitleCallback.invoke(
SubtitleFile(
sub.lang.toString(),
sub.url ?: return@map null
)
)
}
}
})
json?.subtitles?.map { sub ->
subtitleCallback.invoke(
SubtitleFile(
sub.lang.toString(),
sub.url ?: return@map null
)
)
}
}
return true return true
} }