small fix

This commit is contained in:
hexated 2023-03-28 16:14:21 +07:00
parent a83cb83bf1
commit 68991e3941
4 changed files with 110 additions and 23 deletions

View file

@ -668,29 +668,16 @@ object SoraExtractor : SoraStream() {
season: Int? = null,
episode: Int? = null,
subtitleCallback: (SubtitleFile) -> Unit,
) {
val (id, type) = getSoraIdAndType(title, year, season) ?: return
val json = fetchSoraEpisodes(id, type, episode) ?: return
json.subtitlingList?.map { sub ->
subtitleCallback.invoke(
SubtitleFile(
getVipLanguage(sub.languageAbbr ?: return@map),
sub.subtitlingUrl ?: return@map
)
)
}
}
suspend fun invokeSoraStreamLite(
title: String? = null,
year: Int? = null,
season: Int? = null,
episode: Int? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit,
) {
val (id, type) = getSoraIdAndType(title, year, season) ?: return
val (id, type) = getSoraIdAndType(title, year, season) ?: return invokeJustchill(
title,
year,
season,
episode,
subtitleCallback,
callback
)
val json = fetchSoraEpisodes(id, type, episode) ?: return
json.subtitlingList?.map { sub ->
@ -721,6 +708,69 @@ object SoraExtractor : SoraStream() {
}
}
suspend fun invokeJustchill(
title: String? = null,
year: Int? = null,
season: Int? = null,
episode: Int? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit,
) {
val results =
app.get("$chillAPI/api/search?keyword=$title").parsedSafe<ChillSearch>()?.data?.results
val media = if (results?.size == 1) {
results.firstOrNull()
} else {
results?.find {
when (season) {
null -> {
it.name.equals(
title,
true
) && it.releaseTime == "$year"
}
1 -> {
it.name.contains(
"$title",
true
) && (it.releaseTime == "$year" || it.name.contains("Season $season", true))
}
else -> {
it.name.contains(Regex("(?i)$title\\s?($season|${season.toRomanNumeral()}|Season\\s$season)")) && it.releaseTime == "$year"
}
}
}
} ?: return
val episodeId = app.get("$chillAPI/api/detail?id=${media.id}&category=${media.domainType}").parsedSafe<Load>()?.data?.episodeVo?.find {
it.seriesNo == (episode ?: 0)
}?.id ?: return
val sources = app.get("$chillAPI/api/episode?id=${media.id}&category=${media.domainType}&episode=$episodeId").parsedSafe<ChillSources>()?.data
sources?.qualities?.map { source ->
callback.invoke(
ExtractorLink(
"ChillMovie",
"ChillMovie",
source.url ?: return@map null,
"",
source.quality ?: Qualities.Unknown.value,
true,
)
)
}
sources?.subtitles?.map { sub ->
subtitleCallback.invoke(
SubtitleFile(
getVipLanguage(sub.lang ?: return@map), sub.url?.substringAfter("?url=") ?: return@map
)
)
}
}
suspend fun invokeXmovies(
title: String? = null,
year: Int? = null,
@ -3194,3 +3244,38 @@ data class WatchOnlineResponse(
@JsonProperty("streams") val streams: HashMap<String, String>? = null,
@JsonProperty("subtitles") val subtitles: Any? = null,
)
data class ChillQualities(
@JsonProperty("quality") val quality: Int? = null,
@JsonProperty("url") val url: String? = null,
)
data class ChillSubtitles(
@JsonProperty("lang") val lang: String? = null,
@JsonProperty("language") val language: String? = null,
@JsonProperty("url") val url: String? = null,
)
data class ChillSource(
@JsonProperty("qualities") val qualities: ArrayList<ChillQualities>? = arrayListOf(),
@JsonProperty("subtitles") val subtitles: ArrayList<ChillSubtitles>? = arrayListOf(),
)
data class ChillSources(
@JsonProperty("data") val data: ChillSource? = null,
)
data class ChillResults(
@JsonProperty("id") val id: String,
@JsonProperty("domainType") val domainType: Int,
@JsonProperty("name") val name: String,
@JsonProperty("releaseTime") val releaseTime: String,
)
data class ChillData(
@JsonProperty("results") val results: ArrayList<ChillResults>? = arrayListOf(),
)
data class ChillSearch(
@JsonProperty("data") val data: ChillData? = null,
)

View file

@ -367,6 +367,7 @@ open class SoraStream : TmdbProvider() {
res.season,
res.episode,
subtitleCallback,
callback
)
},
{

View file

@ -20,7 +20,7 @@ import com.hexated.SoraExtractor.invokeMovieHab
import com.hexated.SoraExtractor.invokeRStream
import com.hexated.SoraExtractor.invokeSeries9
import com.hexated.SoraExtractor.invokeSmashyStream
import com.hexated.SoraExtractor.invokeSoraStreamLite
import com.hexated.SoraExtractor.invokeSoraStream
import com.hexated.SoraExtractor.invokeTwoEmbed
import com.hexated.SoraExtractor.invokeUniqueStream
import com.hexated.SoraExtractor.invokeVidSrc
@ -54,7 +54,7 @@ class SoraStreamLite : SoraStream() {
)
},
{
invokeSoraStreamLite(
invokeSoraStream(
res.title,
res.year,
res.season,

View file

@ -42,6 +42,7 @@ import kotlin.collections.ArrayList
import kotlin.math.min
val soraAPI = base64DecodeAPI("cA==YXA=cy8=Y20=di8=LnQ=b2s=a2w=bG8=aS4=YXA=ZS0=aWw=b2I=LW0=Z2E=Ly8=czo=dHA=aHQ=")
val chillAPI = base64DecodeAPI("dg==LnQ=bGw=aGk=dGM=dXM=Lmo=b2s=a2w=bG8=Ly8=czo=dHA=aHQ=")
val soraHeaders = mapOf(
"lang" to "en",