fixed SoraVIP

This commit is contained in:
hexated 2022-10-30 08:07:59 +07:00
parent 2c6788d425
commit 6caa65a419
3 changed files with 14 additions and 7 deletions

View file

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

View file

@ -303,20 +303,22 @@ object SoraExtractor : SoraStream() {
val providerId = if (season == null) {
val url = "$mainServerAPI/movies/$id/?_data=routes/movies/\$movieId"
val data = app.get(url).parsedSafe<DetailVipResult>()?.detail
val airDate = (data?.release_date ?: data?.first_air_date)?.substringBefore("-")
app.get(
"$mainServerAPI/api/provider?title=${data?.title ?: data?.name}&type=movie&origTitle=${data?.original_title ?: data?.original_name}&year=${
(data?.release_date ?: data?.first_air_date)?.substringBefore("-")
}&_data=routes/api/provider"
"$mainServerAPI/api/provider?title=${data?.title ?: data?.name}&type=movie&origTitle=${data?.original_title ?: data?.original_name}&year=$airDate&_data=routes/api/provider"
)
.parsedSafe<ProvidersResult>()?.provider?.first { it.provider == "Loklok" }?.id
} else {
val url = "$mainServerAPI/tv-shows/$id/?_data=routes/tv-shows/\$tvId"
val data = app.get(url).parsedSafe<DetailVipResult>()?.detail
val airDate = (if (data?.seasons?.size == 1) {
data.seasons.first().air_date
} else {
data?.seasons?.get(season)?.air_date
})?.substringBefore("-")
app.get(
"$mainServerAPI/api/provider?title=${data?.title ?: data?.name}&type=tv&origTitle=${data?.original_title ?: data?.original_name}&year=${
(data?.release_date ?: data?.first_air_date)?.substringBefore("-")
}&season=$season&_data=routes/api/provider"
"$mainServerAPI/api/provider?title=${data?.title ?: data?.name}&type=tv&origTitle=${data?.original_title ?: data?.original_name}&year=$airDate&season=$season&_data=routes/api/provider"
)
.parsedSafe<ProvidersResult>()?.provider?.first { it.provider == "Loklok" }?.id
}

View file

@ -568,6 +568,10 @@ open class SoraStream : TmdbProvider() {
@JsonProperty("detail") val detail: DetailAnime? = null,
)
data class seasonsVip(
@JsonProperty("air_date") val air_date: String? = null,
)
data class DetailVip(
@JsonProperty("title") val title: String? = null,
@JsonProperty("name") val name: String? = null,
@ -575,6 +579,7 @@ open class SoraStream : TmdbProvider() {
@JsonProperty("original_name") val original_name: String? = null,
@JsonProperty("release_date") val release_date: String? = null,
@JsonProperty("first_air_date") val first_air_date: String? = null,
@JsonProperty("seasons") val seasons: ArrayList<seasonsVip>? = arrayListOf(),
)
data class DetailVipResult(