sora: fix source

This commit is contained in:
hexated 2023-04-22 00:05:06 +07:00
parent a47811680d
commit 0608e1f452
5 changed files with 74 additions and 130 deletions

View File

@ -1,6 +1,19 @@
// use an integer for version numbers
version = 122
import org.jetbrains.kotlin.konan.properties.Properties
// use an integer for version numbers
version = 123
android {
defaultConfig {
val properties = Properties()
properties.load(project.rootProject.file("local.properties").inputStream())
buildConfigField("String", "SORA_API", "\"${properties.getProperty("SORA_API")}\"")
buildConfigField("String", "SORA_WEB", "\"${properties.getProperty("SORA_WEB")}\"")
buildConfigField("String", "CRY_API", "\"${properties.getProperty("CRY_API")}\"")
}
}
cloudstream {
language = "en"

View File

@ -637,14 +637,7 @@ object SoraExtractor : SoraStream() {
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit,
) {
val (id, type) = getSoraIdAndType(title, year, season) ?: return invokeSoraBackup(
title,
year,
season,
episode,
subtitleCallback,
callback
)
val (id, type) = getSoraIdAndType(title, year, season) ?: return
val json = fetchSoraEpisodes(id, type, episode) ?: return
json.subtitlingList?.map { sub ->
@ -656,9 +649,10 @@ object SoraExtractor : SoraStream() {
)
}
if(season == null) return
json.definitionList?.map { video ->
val media = app.get(
"$soraAPI/media/previewInfo?category=${type}&contentId=${id}&episodeId=${json.id}&definition=${video.code}",
"${BuildConfig.SORA_API}/movieDrama/getPlayInfo?category=${type}&contentId=${id}&episodeId=${json.id}&definition=${video.code}",
headers = soraHeaders,
).parsedSafe<SorastreamResponse>()?.data
@ -667,7 +661,7 @@ object SoraExtractor : SoraStream() {
this.name,
this.name,
media?.mediaUrl ?: return@map null,
"",
"${BuildConfig.SORA_WEB}/",
getSoraQuality(media.currentDefinition ?: ""),
true,
)
@ -675,75 +669,6 @@ object SoraExtractor : SoraStream() {
}
}
private suspend fun invokeSoraBackup(
title: String? = null,
year: Int? = null,
season: Int? = null,
episode: Int? = null,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit,
) {
val results =
app.get("$soraBackupAPI/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("$soraBackupAPI/api/detail?id=${media.id}&category=${media.domainType}")
.parsedSafe<Load>()?.data?.episodeVo?.find {
it.seriesNo == (episode ?: 0)
}?.id ?: return
val sources =
app.get("$soraBackupAPI/api/episode?id=${media.id}&category=${media.domainType}&episode=$episodeId")
.parsedSafe<ChillSources>()?.data
sources?.qualities?.map { source ->
callback.invoke(
ExtractorLink(
this.name,
this.name,
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,
@ -2967,7 +2892,7 @@ object SoraExtractor : SoraStream() {
episode: Int? = null,
callback: (ExtractorLink) -> Unit
) {
app.get("$cryMoviesAPI/stream/movie/$imdbId.json")
app.get("${BuildConfig.CRY_API}/stream/movie/$imdbId.json")
.parsedSafe<CryMoviesResponse>()?.streams?.filter {
matchingIndex(
it.title,
@ -3365,41 +3290,6 @@ data class WatchOnlineResponse(
@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,
)
data class PutlockerEpisodes(
@JsonProperty("html") val html: String? = null,
)

View File

@ -83,7 +83,8 @@ open class SoraStream : TmdbProvider() {
const val gdbot = "https://gdbot.xyz"
const val consumetAnilistAPI = "https://api.consumet.org/meta/anilist"
private val apiKey = base64DecodeAPI("ZTM=NTg=MjM=MjM=ODc=MzI=OGQ=MmE=Nzk=Nzk=ZjI=NTA=NDY=NDA=MzA=YjA=") // PLEASE DON'T STEAL
private val apiKey =
base64DecodeAPI("ZTM=NTg=MjM=MjM=ODc=MzI=OGQ=MmE=Nzk=Nzk=ZjI=NTA=NDY=NDA=MzA=YjA=") // PLEASE DON'T STEAL
/** ALL SOURCES */
const val twoEmbedAPI = "https://www.2embed.to"
@ -120,12 +121,14 @@ open class SoraStream : TmdbProvider() {
const val movie123NetAPI = "https://ww8.0123movie.net"
const val smashyStreamAPI = "https://embed.smashystream.com"
const val watchSomuchAPI = "https://watchsomuch.tv" // sub only
val gomoviesAPI = base64DecodeAPI("bQ==Y28=ZS4=aW4=bmw=LW8=ZXM=dmk=bW8=Z28=Ly8=czo=dHA=aHQ=")
val gomoviesAPI =
base64DecodeAPI("bQ==Y28=ZS4=aW4=bmw=LW8=ZXM=dmk=bW8=Z28=Ly8=czo=dHA=aHQ=")
const val ask4MoviesAPI = "https://ask4movie.mx"
const val biliBiliAPI = "https://api-vn.kaguya.app/server"
const val watchOnlineAPI = "https://watchonline.ag"
const val nineTvAPI = "https://api.9animetv.live"
const val putlockerAPI = "https://ww7.putlocker.vip"
// INDEX SITE
const val baymoviesAPI = "https://opengatewayindex.pages.dev" // dead
const val chillmovies0API = "https://chill.aicirou.workers.dev/0:" // dead
@ -146,7 +149,6 @@ open class SoraStream : TmdbProvider() {
const val shinobiMovieAPI = "https://home.shinobicloud.cf/0:"
const val vitoenMovieAPI = "https://openmatte.vitoencodes.workers.dev/0:"
const val shivamhwAPI = "https://foogle.shivamhw.me"
val cryMoviesAPI = base64DecodeAPI("ZXY=LmQ=cnM=a2U=b3I=Lnc=ZXI=ZGQ=bGE=cy0=b2I=YWM=Lmo=YWw=aW4=LWY=cm4=Ym8=cmU=Ly8=czo=dHA=aHQ=")
fun getType(t: String?): TvType {
return when (t) {
@ -429,7 +431,14 @@ open class SoraStream : TmdbProvider() {
)
},
{
invokeSeries9(res.title, res.year, res.season, res.episode, subtitleCallback, callback)
invokeSeries9(
res.title,
res.year,
res.season,
res.episode,
subtitleCallback,
callback
)
},
{
invokeIdlix(
@ -455,7 +464,13 @@ open class SoraStream : TmdbProvider() {
// )
// },
{
if (!res.isAnime) invokeFilmxy(res.imdbId, res.season, res.episode, subtitleCallback, callback)
if (!res.isAnime) invokeFilmxy(
res.imdbId,
res.season,
res.episode,
subtitleCallback,
callback
)
},
{
invokeKimcartoon(res.title, res.season, res.episode, subtitleCallback, callback)
@ -471,7 +486,14 @@ open class SoraStream : TmdbProvider() {
)
},
{
invokeFmovies(res.title, res.airedYear ?: res.year, res.season, res.episode, subtitleCallback, callback)
invokeFmovies(
res.title,
res.airedYear ?: res.year,
res.season,
res.episode,
subtitleCallback,
callback
)
},
{
invokeKisskh(res.title, res.season, res.episode, subtitleCallback, callback)
@ -624,7 +646,13 @@ open class SoraStream : TmdbProvider() {
)
},
{
if (!res.isAnime) invokeNinetv(res.id, res.season, res.episode, subtitleCallback, callback)
if (!res.isAnime) invokeNinetv(
res.id,
res.season,
res.episode,
subtitleCallback,
callback
)
},
{
if (!res.isAnime) invokeBlackmovies(
@ -732,7 +760,13 @@ open class SoraStream : TmdbProvider() {
// if (!res.isAnime) invokeTgarMovies(res.title, res.year, res.season, res.episode, callback)
// },
{
if (!res.isAnime) invokeGdbotMovies(res.title, res.year, res.season, res.episode, callback)
if (!res.isAnime) invokeGdbotMovies(
res.title,
res.year,
res.season,
res.episode,
callback
)
},
{
if (!res.isAnime) invokeJmdkhMovies(
@ -779,7 +813,14 @@ open class SoraStream : TmdbProvider() {
)
},
{
if (!res.isAnime) invokeAsk4Movies(res.title, res.year, res.season, res.episode, subtitleCallback, callback)
if (!res.isAnime) invokeAsk4Movies(
res.title,
res.year,
res.season,
res.episode,
subtitleCallback,
callback
)
},
{
invokeWatchOnline(
@ -794,7 +835,7 @@ open class SoraStream : TmdbProvider() {
)
},
{
if(!res.isAnime) invokeShivamhw(
if (!res.isAnime) invokeShivamhw(
res.title,
res.year,
res.season,
@ -803,7 +844,7 @@ open class SoraStream : TmdbProvider() {
)
},
{
if(!res.isAnime && res.season == null) invokeCryMovies(
if (!res.isAnime && res.season == null) invokeCryMovies(
res.imdbId,
res.title,
res.year,

View File

@ -42,7 +42,6 @@ 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 soraBackupAPI = base64DecodeAPI("dHY=bC4=aWw=Y2g=c3Q=anU=MS4=b2s=a2w=bG8=Ly8=czo=dHA=aHQ=")
val soraHeaders = mapOf(
"lang" to "en",

View File

@ -1,5 +1,6 @@
import com.lagradost.cloudstream3.gradle.CloudstreamExtension
import com.android.build.gradle.BaseExtension
//import org.jetbrains.kotlin.konan.properties.Properties
buildscript {
repositories {
@ -51,7 +52,7 @@ subprojects {
// val properties = Properties()
// properties.load(project.rootProject.file("local.properties").inputStream())
//
// buildConfigField("String", "API_KEY", "\"${properties.getProperty("API_KEY")}\"")
// buildConfigField("String", "LOKLOK_API", "\"${properties.getProperty("LOKLOK_API")}\"")
}