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
|
// use an integer for version numbers
|
||||||
version = 49
|
version = 50
|
||||||
|
|
||||||
|
|
||||||
cloudstream {
|
cloudstream {
|
||||||
|
|
|
@ -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,28 +832,27 @@ 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,
|
||||||
|
headers = headers,
|
||||||
|
).text.let { tryParseJson<PreviewResponse>(it)?.data?.firstOrNull() }
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
ExtractorLink(
|
ExtractorLink(
|
||||||
"${this.name} (vip)",
|
this.name,
|
||||||
"${this.name} (vip)",
|
this.name,
|
||||||
link?.mediaUrl ?: return@let,
|
response?.mediaUrl ?: return@map null,
|
||||||
"",
|
"",
|
||||||
getQualityFromName(video.description),
|
getSoraQuality(response.currentDefinition ?: ""),
|
||||||
isM3u8 = true,
|
isM3u8 = true,
|
||||||
headers = headers
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
suspend fun invokeXmovies(
|
suspend fun invokeXmovies(
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
year: Int? = null,
|
year: Int? = null,
|
||||||
|
@ -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,
|
||||||
|
)
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
|
@ -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}"
|
||||||
|
|
Loading…
Reference in a new issue