[Sora] fix .

This commit is contained in:
hexated 2022-12-10 03:54:40 +07:00
parent 978c5bc6ba
commit 2876dea2d1
4 changed files with 42 additions and 22 deletions

View file

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

View file

@ -10,7 +10,9 @@ import com.lagradost.nicehttp.Session
import com.google.gson.JsonParser import com.google.gson.JsonParser
import com.lagradost.cloudstream3.extractors.XStreamCdn import com.lagradost.cloudstream3.extractors.XStreamCdn
import com.lagradost.cloudstream3.network.CloudflareKiller import com.lagradost.cloudstream3.network.CloudflareKiller
import com.lagradost.nicehttp.RequestBodyTypes
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody.Companion.toRequestBody import okhttp3.RequestBody.Companion.toRequestBody
val session = Session(Requests().baseClient) val session = Session(Requests().baseClient)
@ -830,26 +832,25 @@ object SoraExtractor : SoraStream() {
) )
} }
json?.definitionList?.apmap { video -> json?.definitionList?.map { video ->
delay(1000) val body = """[{"category":$type,"contentId":"$id","episodeId":${json.id},"definition":"${video.code}"}]""".toRequestBody(
app.get( RequestBodyTypes.JSON.toMediaTypeOrNull())
"${vipAPI}/media/previewInfo?category=${type}&contentId=${id}&episodeId=${json.id}&definition=${video.code}", val response = app.post(
headers = headers "${vipAPI}/media/bathGetplayInfo",
).parsedSafe<Video>()?.data.let { link -> requestBody = body,
callback.invoke( headers = headers,
ExtractorLink( ).text.let { tryParseJson<PreviewResponse>(it)?.data?.firstOrNull() }
"${this.name} (vip)", callback.invoke(
"${this.name} (vip)", ExtractorLink(
link?.mediaUrl ?: return@let, this.name,
"", this.name,
getQualityFromName(video.description), response?.mediaUrl ?: return@map null,
isM3u8 = true, "",
headers = headers getSoraQuality(response.currentDefinition ?: ""),
) isM3u8 = true,
) )
} )
} }
} }
suspend fun invokeXmovies( suspend fun invokeXmovies(
@ -1654,3 +1655,12 @@ data class DriveBotLink(
data class DirectDl( data class DirectDl(
@JsonProperty("download_url") val download_url: String? = null, @JsonProperty("download_url") val download_url: String? = null,
) )
data class PreviewResponse(
@JsonProperty("data") val data: ArrayList<PreviewVideos>? = arrayListOf(),
)
data class PreviewVideos(
@JsonProperty("mediaUrl") val mediaUrl: String? = null,
@JsonProperty("currentDefinition") val currentDefinition: String? = null,
)

View file

@ -425,9 +425,9 @@ open class SoraStream : TmdbProvider() {
{ {
if(!res.isAnime) invokeGMovies(res.title, res.year, res.season, res.episode, subtitleCallback, callback) if(!res.isAnime) invokeGMovies(res.title, res.year, res.season, res.episode, subtitleCallback, callback)
}, },
{ // {
if(!res.isAnime) invokeFDMovies(res.title, res.season, res.episode, subtitleCallback, callback) // if(!res.isAnime) invokeFDMovies(res.title, res.season, res.episode, subtitleCallback, callback)
}, // },
{ {
invokeM4uhd(res.title, res.year, res.season, res.episode, subtitleCallback, callback) invokeM4uhd(res.title, res.year, res.season, res.episode, subtitleCallback, callback)
} }

View file

@ -303,6 +303,16 @@ fun getGMoviesQuality(str: String): Int {
} }
} }
fun getSoraQuality(quality: String): Int {
return when (quality) {
"GROOT_FD" -> Qualities.P360.value
"GROOT_LD" -> Qualities.P480.value
"GROOT_SD" -> Qualities.P720.value
"GROOT_HD" -> Qualities.P1080.value
else -> Qualities.Unknown.value
}
}
fun getBaseUrl(url: String): String { fun getBaseUrl(url: String): String {
return URI(url).let { return URI(url).let {
"${it.scheme}://${it.host}" "${it.scheme}://${it.host}"