update Sora Home

This commit is contained in:
hexated 2022-10-30 12:24:44 +07:00
parent 6caa65a419
commit e65246dea0
3 changed files with 16 additions and 12 deletions

View file

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

View file

@ -300,25 +300,25 @@ object SoraExtractor : SoraStream() {
subtitleCallback: (SubtitleFile) -> Unit, subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
) { ) {
val providerId = if (season == null) { val url = if(season == null) {
val url = "$mainServerAPI/movies/$id/?_data=routes/movies/\$movieId" "$mainServerAPI/movies/$id/?_data=routes/movies/\$movieId"
} else {
"$mainServerAPI/tv-shows/$id/?_data=routes/tv-shows/\$tvId"
}
val data = app.get(url).parsedSafe<DetailVipResult>()?.detail val data = app.get(url).parsedSafe<DetailVipResult>()?.detail
val title = data?.title ?: data?.name
val origTitle = data?.original_title ?: data?.original_name
val providerId = if (season == null) {
val airDate = (data?.release_date ?: data?.first_air_date)?.substringBefore("-") val airDate = (data?.release_date ?: data?.first_air_date)?.substringBefore("-")
app.get( app.get(
"$mainServerAPI/api/provider?title=${data?.title ?: data?.name}&type=movie&origTitle=${data?.original_title ?: data?.original_name}&year=$airDate&_data=routes/api/provider" "$mainServerAPI/api/provider?title=$title&type=movie&origTitle=$origTitle&year=$airDate&_data=routes/api/provider"
) )
.parsedSafe<ProvidersResult>()?.provider?.first { it.provider == "Loklok" }?.id .parsedSafe<ProvidersResult>()?.provider?.first { it.provider == "Loklok" }?.id
} else { } else {
val url = "$mainServerAPI/tv-shows/$id/?_data=routes/tv-shows/\$tvId" val airDate = data?.seasons?.first { it.season_number == season }?.air_date?.substringBefore("-")
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( app.get(
"$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" "$mainServerAPI/api/provider?title=$title&type=tv&origTitle=$origTitle&year=$airDate&season=$season&_data=routes/api/provider"
) )
.parsedSafe<ProvidersResult>()?.provider?.first { it.provider == "Loklok" }?.id .parsedSafe<ProvidersResult>()?.provider?.first { it.provider == "Loklok" }?.id
} }

View file

@ -86,10 +86,13 @@ open class SoraStream : TmdbProvider() {
} }
override val mainPage = mainPageOf( override val mainPage = mainPageOf(
"$tmdbAPI/tv/airing_today?api_key=$apiKey&region=&page=" to "Airing Today TV Shows",
"$tmdbAPI/movie/popular?api_key=$apiKey&region=&page=" to "Popular Movies", "$tmdbAPI/movie/popular?api_key=$apiKey&region=&page=" to "Popular Movies",
"$tmdbAPI/tv/popular?api_key=$apiKey&region=&page=" to "Popular TV Shows", "$tmdbAPI/tv/popular?api_key=$apiKey&region=&page=" to "Popular TV Shows",
"$tmdbAPI/tv/on_the_air?api_key=$apiKey&region=&page=" to "On The Air TV Shows",
"$tmdbAPI/movie/top_rated?api_key=$apiKey&region=&page=" to "Top Rated Movies", "$tmdbAPI/movie/top_rated?api_key=$apiKey&region=&page=" to "Top Rated Movies",
"$tmdbAPI/tv/top_rated?api_key=$apiKey&region=&page=" to "Top Rated TV Shows", "$tmdbAPI/tv/top_rated?api_key=$apiKey&region=&page=" to "Top Rated TV Shows",
"$tmdbAPI/movie/upcoming?api_key=$apiKey&region=&page=" to "Upcoming Movies",
"$tmdbAPI/discover/tv?api_key=$apiKey&with_keywords=210024|222243&page=" to "Anime", "$tmdbAPI/discover/tv?api_key=$apiKey&with_keywords=210024|222243&page=" to "Anime",
"$tmdbAPI/discover/movie?api_key=$apiKey&with_keywords=210024|222243&page=" to "Anime Movies", "$tmdbAPI/discover/movie?api_key=$apiKey&with_keywords=210024|222243&page=" to "Anime Movies",
) )
@ -570,6 +573,7 @@ open class SoraStream : TmdbProvider() {
data class seasonsVip( data class seasonsVip(
@JsonProperty("air_date") val air_date: String? = null, @JsonProperty("air_date") val air_date: String? = null,
@JsonProperty("season_number") val season_number: Int? = null,
) )
data class DetailVip( data class DetailVip(