fixed SoraVIP

This commit is contained in:
hexated 2022-11-08 16:08:34 +07:00
parent 21a51840da
commit c26fdc1724
3 changed files with 132 additions and 6 deletions

View file

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

View file

@ -302,7 +302,7 @@ object SoraExtractor : SoraStream() {
loadExtractor(url, databaseGdriveAPI, subtitleCallback, callback) loadExtractor(url, databaseGdriveAPI, subtitleCallback, callback)
} }
suspend fun invokeSoraVIP( /* suspend fun invokeSoraVIP(
title: String? = null, title: String? = null,
orgTitle: String? = null, orgTitle: String? = null,
year: Int? = null, year: Int? = null,
@ -350,7 +350,7 @@ object SoraExtractor : SoraStream() {
) )
} }
} }
*/
suspend fun invokeGogo( suspend fun invokeGogo(
aniId: String? = null, aniId: String? = null,
animeId: String? = null, animeId: String? = null,
@ -756,6 +756,91 @@ object SoraExtractor : SoraStream() {
} }
} }
suspend fun invokeSoraVIP(
title: String? = null,
year: Int? = null,
season: Int? = null,
episode: Int? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
) {
val headers = mapOf(
"lang" to "en",
"versioncode" to "11",
"clienttype" to "ios_jike_default"
)
val vipAPI = base64DecodeAPI("cA==YXA=cy8=Y20=di8=LnQ=b2s=a2w=bG8=aS4=YXA=ZS0=aWw=b2I=LW0=Z2E=Ly8=czo=dHA=aHQ=")
val vipUrl = base64DecodeAPI("b20=LmM=b2s=a2w=bG8=Ly8=czo=dHA=aHQ=")
val doc = app.get(
"$vipUrl/search?keyword=$title",
).document
val scriptData = doc.select("div.search-list div.search-video-card").map {
Triple(
it.selectFirst("h2.title")?.text().toString(),
it.selectFirst("div.desc")?.text()
?.substringBefore(".")?.toIntOrNull(),
it.selectFirst("a")?.attr("href")?.split("/")
)
}
val script = if (scriptData.size == 1) {
scriptData.first()
} else {
scriptData.first {
if (season == null) {
it.first.equals(
title,
true
) && it.second == year
} else {
it.first.contains(
"$title",
true
) && (it.second == year || it.first.contains("Season $season", true))
}
}
}
val id = script.third?.last()
val type = script.third?.get(2)
val json = app.get(
"$vipAPI/movieDrama/get?id=${id}&category=${type}",
headers = headers
).parsedSafe<Load>()?.data?.episodeVo?.first { it.seriesNo == (episode ?: 0) }
json?.definitionList?.apmap { video ->
app.get(
"${vipAPI}/media/previewInfo?category=${type}&contentId=${id}&episodeId=${json.id}&definition=${video.code}",
headers = headers
).parsedSafe<Video>()?.data.let { link ->
callback.invoke(
ExtractorLink(
"${this.name} (vip)",
"${this.name} (vip)",
link?.mediaUrl ?: return@let,
"",
getQualityFromName(video.description),
isM3u8 = true,
headers = headers
)
)
}
}
json?.subtitlingList?.map { sub ->
subtitleCallback.invoke(
SubtitleFile(
getVipLanguage(sub.languageAbbr ?: return@map),
sub.subtitlingUrl ?: return@map
)
)
}
}
} }
data class FilmxyCookies( data class FilmxyCookies(
@ -820,6 +905,16 @@ fun getLanguage(str: String): String {
return if (str.contains("(in_ID)")) "Indonesian" else str return if (str.contains("(in_ID)")) "Indonesian" else str
} }
private fun getVipLanguage(str: String): String {
return when (str) {
"in_ID" -> "Indonesian"
"pt" -> "Portuguese"
else -> str.split("_").first().let {
SubtitleHelper.fromTwoLettersToLanguage(it).toString()
}
}
}
private fun getQuality(str: String): Int { private fun getQuality(str: String): Int {
return when (str) { return when (str) {
"360p" -> Qualities.P240.value "360p" -> Qualities.P240.value
@ -936,3 +1031,37 @@ data class RabbitSources(
@JsonProperty("tracks") val tracks: ArrayList<Track>? = arrayListOf(), @JsonProperty("tracks") val tracks: ArrayList<Track>? = arrayListOf(),
) )
data class VideoData(
@JsonProperty("mediaUrl") val mediaUrl: String? = null,
)
data class Video(
@JsonProperty("data") val data: VideoData? = null,
)
data class SubtitlingList(
@JsonProperty("languageAbbr") val languageAbbr: String? = null,
@JsonProperty("language") val language: String? = null,
@JsonProperty("subtitlingUrl") val subtitlingUrl: String? = null,
)
data class DefinitionList(
@JsonProperty("code") val code: String? = null,
@JsonProperty("description") val description: String? = null,
)
data class EpisodeVo(
@JsonProperty("id") val id: Int? = null,
@JsonProperty("seriesNo") val seriesNo: Int? = null,
@JsonProperty("definitionList") val definitionList: ArrayList<DefinitionList>? = arrayListOf(),
@JsonProperty("subtitlingList") val subtitlingList: ArrayList<SubtitlingList>? = arrayListOf(),
)
data class MediaDetail(
@JsonProperty("episodeVo") val episodeVo: ArrayList<EpisodeVo>? = arrayListOf(),
)
data class Load(
@JsonProperty("data") val data: MediaDetail? = null,
)

View file

@ -3,14 +3,12 @@ package com.hexated
import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonProperty
import com.hexated.RandomUserAgent.getRandomUserAgent import com.hexated.RandomUserAgent.getRandomUserAgent
import com.hexated.SoraExtractor.invoke123Movie import com.hexated.SoraExtractor.invoke123Movie
import com.hexated.SoraExtractor.invokeDatabaseGdrive
import com.hexated.SoraExtractor.invokeDbgo import com.hexated.SoraExtractor.invokeDbgo
import com.hexated.SoraExtractor.invokeFilmxy import com.hexated.SoraExtractor.invokeFilmxy
import com.hexated.SoraExtractor.invokeGogo import com.hexated.SoraExtractor.invokeGogo
import com.hexated.SoraExtractor.invokeHDMovieBox import com.hexated.SoraExtractor.invokeHDMovieBox
import com.hexated.SoraExtractor.invokeIdlix import com.hexated.SoraExtractor.invokeIdlix
import com.hexated.SoraExtractor.invokeKimcartoon import com.hexated.SoraExtractor.invokeKimcartoon
import com.hexated.SoraExtractor.invokeLocalSources
import com.hexated.SoraExtractor.invokeMovieHab import com.hexated.SoraExtractor.invokeMovieHab
import com.hexated.SoraExtractor.invokeNoverse import com.hexated.SoraExtractor.invokeNoverse
import com.hexated.SoraExtractor.invokeOlgply import com.hexated.SoraExtractor.invokeOlgply
@ -337,7 +335,6 @@ open class SoraStream : TmdbProvider() {
{ {
invokeSoraVIP( invokeSoraVIP(
res.title, res.title,
res.orgTitle,
res.year, res.year,
res.season, res.season,
res.episode, res.episode,