mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
[Sora] fix .
This commit is contained in:
parent
978c5bc6ba
commit
2876dea2d1
4 changed files with 42 additions and 22 deletions
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 49
|
||||
version = 50
|
||||
|
||||
|
||||
cloudstream {
|
||||
|
|
|
@ -10,7 +10,9 @@ import com.lagradost.nicehttp.Session
|
|||
import com.google.gson.JsonParser
|
||||
import com.lagradost.cloudstream3.extractors.XStreamCdn
|
||||
import com.lagradost.cloudstream3.network.CloudflareKiller
|
||||
import com.lagradost.nicehttp.RequestBodyTypes
|
||||
import kotlinx.coroutines.delay
|
||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||
import okhttp3.RequestBody.Companion.toRequestBody
|
||||
|
||||
val session = Session(Requests().baseClient)
|
||||
|
@ -830,28 +832,27 @@ object SoraExtractor : SoraStream() {
|
|||
)
|
||||
}
|
||||
|
||||
json?.definitionList?.apmap { video ->
|
||||
delay(1000)
|
||||
app.get(
|
||||
"${vipAPI}/media/previewInfo?category=${type}&contentId=${id}&episodeId=${json.id}&definition=${video.code}",
|
||||
headers = headers
|
||||
).parsedSafe<Video>()?.data.let { link ->
|
||||
json?.definitionList?.map { video ->
|
||||
val body = """[{"category":$type,"contentId":"$id","episodeId":${json.id},"definition":"${video.code}"}]""".toRequestBody(
|
||||
RequestBodyTypes.JSON.toMediaTypeOrNull())
|
||||
val response = app.post(
|
||||
"${vipAPI}/media/bathGetplayInfo",
|
||||
requestBody = body,
|
||||
headers = headers,
|
||||
).text.let { tryParseJson<PreviewResponse>(it)?.data?.firstOrNull() }
|
||||
callback.invoke(
|
||||
ExtractorLink(
|
||||
"${this.name} (vip)",
|
||||
"${this.name} (vip)",
|
||||
link?.mediaUrl ?: return@let,
|
||||
this.name,
|
||||
this.name,
|
||||
response?.mediaUrl ?: return@map null,
|
||||
"",
|
||||
getQualityFromName(video.description),
|
||||
getSoraQuality(response.currentDefinition ?: ""),
|
||||
isM3u8 = true,
|
||||
headers = headers
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
suspend fun invokeXmovies(
|
||||
title: String? = null,
|
||||
year: Int? = null,
|
||||
|
@ -1654,3 +1655,12 @@ data class DriveBotLink(
|
|||
data class DirectDl(
|
||||
@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,
|
||||
)
|
|
@ -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) 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)
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
return URI(url).let {
|
||||
"${it.scheme}://${it.host}"
|
||||
|
|
Loading…
Reference in a new issue