mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
sora/series: added Upcoming
This commit is contained in:
parent
dbab64a82b
commit
b93f93a0d8
5 changed files with 24 additions and 10 deletions
|
@ -1,7 +1,7 @@
|
||||||
import org.jetbrains.kotlin.konan.properties.Properties
|
import org.jetbrains.kotlin.konan.properties.Properties
|
||||||
|
|
||||||
// use an integer for version numbers
|
// use an integer for version numbers
|
||||||
version = 138
|
version = 139
|
||||||
|
|
||||||
android {
|
android {
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
|
|
|
@ -2924,19 +2924,21 @@ object SoraExtractor : SoraStream() {
|
||||||
year,
|
year,
|
||||||
season,
|
season,
|
||||||
episode,
|
episode,
|
||||||
true
|
false
|
||||||
)
|
)
|
||||||
}?.map { stream ->
|
}?.apmap { stream ->
|
||||||
val quality = getIndexQuality(stream.title)
|
val quality = getIndexQuality(stream.title)
|
||||||
val tags = getIndexQualityTags(stream.title)
|
val tags = getIndexQualityTags(stream.title)
|
||||||
val size = getIndexSize(stream.title)
|
val size = getIndexSize(stream.title)
|
||||||
val headers = stream.behaviorHints?.proxyHeaders?.request ?: mapOf()
|
val headers = stream.behaviorHints?.proxyHeaders?.request ?: mapOf()
|
||||||
|
|
||||||
|
if(!app.get(stream.url ?: return@apmap, headers = headers).isSuccessful) return@apmap
|
||||||
|
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
ExtractorLink(
|
ExtractorLink(
|
||||||
"CryMovies",
|
"CryMovies",
|
||||||
"CryMovies $tags [${size}]",
|
"CryMovies $tags [${size}]",
|
||||||
stream.url ?: return@map,
|
stream.url,
|
||||||
"",
|
"",
|
||||||
quality,
|
quality,
|
||||||
headers = headers
|
headers = headers
|
||||||
|
@ -2948,10 +2950,13 @@ object SoraExtractor : SoraStream() {
|
||||||
|
|
||||||
suspend fun invokeNowTv(
|
suspend fun invokeNowTv(
|
||||||
tmdbId: Int? = null,
|
tmdbId: Int? = null,
|
||||||
|
season: Int? = null,
|
||||||
|
episode: Int? = null,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit
|
||||||
) {
|
) {
|
||||||
val referer = "https://2now.tv/"
|
val referer = "https://2now.tv/"
|
||||||
val url = "$nowTvAPI/$tmdbId.mp4"
|
val (seasonSlug, episodeSlug) = getEpisodeSlug(season, episode)
|
||||||
|
val url = if(season == null) "$nowTvAPI/$tmdbId.mp4" else "$nowTvAPI/tv/$tmdbId/s${season}e${episodeSlug}.mp4"
|
||||||
if (!app.get(url, referer = referer).isSuccessful) return
|
if (!app.get(url, referer = referer).isSuccessful) return
|
||||||
callback.invoke(
|
callback.invoke(
|
||||||
ExtractorLink(
|
ExtractorLink(
|
||||||
|
|
|
@ -254,7 +254,8 @@ open class SoraStream : TmdbProvider() {
|
||||||
val poster = getOriImageUrl(res.posterPath)
|
val poster = getOriImageUrl(res.posterPath)
|
||||||
val bgPoster = getOriImageUrl(res.backdropPath)
|
val bgPoster = getOriImageUrl(res.backdropPath)
|
||||||
val orgTitle = res.originalTitle ?: res.originalName ?: return null
|
val orgTitle = res.originalTitle ?: res.originalName ?: return null
|
||||||
val year = (res.releaseDate ?: res.firstAirDate)?.split("-")?.first()?.toIntOrNull()
|
val releaseDate = res.releaseDate ?: res.firstAirDate
|
||||||
|
val year = releaseDate?.split("-")?.first()?.toIntOrNull()
|
||||||
val rating = res.vote_average.toString().toRatingInt()
|
val rating = res.vote_average.toString().toRatingInt()
|
||||||
val genres = res.genres?.mapNotNull { it.name }
|
val genres = res.genres?.mapNotNull { it.name }
|
||||||
val isAnime =
|
val isAnime =
|
||||||
|
@ -300,7 +301,7 @@ open class SoraStream : TmdbProvider() {
|
||||||
date = season.airDate,
|
date = season.airDate,
|
||||||
airedDate = res.releaseDate ?: res.firstAirDate
|
airedDate = res.releaseDate ?: res.firstAirDate
|
||||||
).toJson(),
|
).toJson(),
|
||||||
name = eps.name,
|
name = eps.name + if(isUpcoming(eps.airDate)) " - [UPCOMING]" else "",
|
||||||
season = eps.seasonNumber,
|
season = eps.seasonNumber,
|
||||||
episode = eps.episodeNumber,
|
episode = eps.episodeNumber,
|
||||||
posterUrl = getImageUrl(eps.stillPath),
|
posterUrl = getImageUrl(eps.stillPath),
|
||||||
|
@ -347,7 +348,7 @@ open class SoraStream : TmdbProvider() {
|
||||||
) {
|
) {
|
||||||
this.posterUrl = poster
|
this.posterUrl = poster
|
||||||
this.backgroundPosterUrl = bgPoster
|
this.backgroundPosterUrl = bgPoster
|
||||||
this.comingSoon = res.status != "Released"
|
this.comingSoon = isUpcoming(releaseDate)
|
||||||
this.year = year
|
this.year = year
|
||||||
this.plot = res.overview
|
this.plot = res.overview
|
||||||
this.duration = res.runtime
|
this.duration = res.runtime
|
||||||
|
@ -791,7 +792,7 @@ open class SoraStream : TmdbProvider() {
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
if (!res.isAnime && res.season == null) invokeNowTv(res.id, callback)
|
if (!res.isAnime && res.season == null) invokeNowTv(res.id, res.season, res.episode, callback)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -274,7 +274,7 @@ class SoraStreamLite : SoraStream() {
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
if (!res.isAnime && res.season == null) invokeNowTv(res.id, callback)
|
if (!res.isAnime && res.season == null) invokeNowTv(res.id, res.season, res.episode, callback)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ import com.hexated.SoraStream.Companion.tvMoviesAPI
|
||||||
import com.hexated.SoraStream.Companion.watchOnlineAPI
|
import com.hexated.SoraStream.Companion.watchOnlineAPI
|
||||||
import com.lagradost.cloudstream3.*
|
import com.lagradost.cloudstream3.*
|
||||||
import com.lagradost.cloudstream3.APIHolder.getCaptchaToken
|
import com.lagradost.cloudstream3.APIHolder.getCaptchaToken
|
||||||
|
import com.lagradost.cloudstream3.APIHolder.unixTimeMS
|
||||||
import com.lagradost.cloudstream3.mvvm.suspendSafeApiCall
|
import com.lagradost.cloudstream3.mvvm.suspendSafeApiCall
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.toJson
|
import com.lagradost.cloudstream3.utils.AppUtils.toJson
|
||||||
|
@ -36,6 +37,7 @@ import java.net.*
|
||||||
import java.nio.charset.StandardCharsets
|
import java.nio.charset.StandardCharsets
|
||||||
import java.security.MessageDigest
|
import java.security.MessageDigest
|
||||||
import java.security.SecureRandom
|
import java.security.SecureRandom
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import javax.crypto.Cipher
|
import javax.crypto.Cipher
|
||||||
import javax.crypto.spec.IvParameterSpec
|
import javax.crypto.spec.IvParameterSpec
|
||||||
|
@ -1521,6 +1523,12 @@ fun getBaseUrl(url: String): String {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun isUpcoming(dateString: String?) : Boolean {
|
||||||
|
if(dateString == null) return false
|
||||||
|
val format = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault())
|
||||||
|
val dateTime = format.parse(dateString)?.time ?: return false
|
||||||
|
return unixTimeMS < dateTime
|
||||||
|
}
|
||||||
fun decode(input: String): String = URLDecoder.decode(input, "utf-8")
|
fun decode(input: String): String = URLDecoder.decode(input, "utf-8")
|
||||||
|
|
||||||
fun encode(input: String): String = URLEncoder.encode(input, "utf-8").replace("+", "%20")
|
fun encode(input: String): String = URLEncoder.encode(input, "utf-8").replace("+", "%20")
|
||||||
|
|
Loading…
Reference in a new issue