mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
sora: more fix missing show in watchOnline
This commit is contained in:
parent
d9cec35f8a
commit
bf3c03ce71
4 changed files with 43 additions and 19 deletions
|
@ -2715,33 +2715,28 @@ object SoraExtractor : SoraStream() {
|
||||||
imdbId: String? = null,
|
imdbId: String? = null,
|
||||||
tmdbId: Int? = null,
|
tmdbId: Int? = null,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
|
year: Int? = null,
|
||||||
season: Int? = null,
|
season: Int? = null,
|
||||||
episode: Int? = null,
|
episode: Int? = null,
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit,
|
callback: (ExtractorLink) -> Unit,
|
||||||
) {
|
) {
|
||||||
val url = if (season == null) {
|
val id = imdbId?.removePrefix("tt")
|
||||||
"$watchOnlineAPI/api/v1/movies?filters[q]=$title"
|
val slug = title.createSlug()
|
||||||
|
val url = if(season == null) {
|
||||||
|
"$watchOnlineAPI/movies/view/$id-$slug-$year"
|
||||||
} else {
|
} else {
|
||||||
"$watchOnlineAPI/api/v1/shows?filters[q]=$title"
|
"$watchOnlineAPI/shows/view/$id-$slug-$year"
|
||||||
}
|
}
|
||||||
|
|
||||||
val baseUrl = if(season == null) {
|
var res = app.get(url)
|
||||||
"$watchOnlineAPI/movies/view"
|
if(!res.isSuccessful) res = searchWatchOnline(title, season, imdbId, tmdbId) ?: return
|
||||||
} else {
|
|
||||||
"$watchOnlineAPI/shows/view"
|
|
||||||
}
|
|
||||||
|
|
||||||
val mediaId = app.get(url).parsedSafe<WatchOnlineSearch>()?.items?.find {
|
|
||||||
it.imdb_id == imdbId || it.tmdb_id == tmdbId || it.imdb_id == imdbId?.removePrefix("tt")
|
|
||||||
}?.slug
|
|
||||||
|
|
||||||
val detailRes = app.get(fixUrl(mediaId ?: return, baseUrl)).document
|
|
||||||
|
|
||||||
|
val doc = res.document
|
||||||
val episodeId = if (season == null) {
|
val episodeId = if (season == null) {
|
||||||
detailRes.selectFirst("div.movie__buttons-items a")?.attr("data-watch-list-media-id")
|
doc.selectFirst("div.movie__buttons-items a")?.attr("data-watch-list-media-id")
|
||||||
} else {
|
} else {
|
||||||
detailRes.select("ul[data-season-episodes=$season] li").find {
|
doc.select("ul[data-season-episodes=$season] li").find {
|
||||||
it.select("div.episodes__number").text().equals("Episode $episode", true)
|
it.select("div.episodes__number").text().equals("Episode $episode", true)
|
||||||
}?.attr("data-id-episode")
|
}?.attr("data-id-episode")
|
||||||
} ?: return
|
} ?: return
|
||||||
|
@ -2768,7 +2763,6 @@ object SoraExtractor : SoraStream() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO find better way
|
|
||||||
val subtitles = json?.subtitles as ArrayList<HashMap<String, String>>
|
val subtitles = json?.subtitles as ArrayList<HashMap<String, String>>
|
||||||
|
|
||||||
subtitles.map { sub ->
|
subtitles.map { sub ->
|
||||||
|
|
|
@ -139,7 +139,7 @@ open class SoraStream : TmdbProvider() {
|
||||||
const val tgarMovieAPI = "https://tgarchive.eu.org"
|
const val tgarMovieAPI = "https://tgarchive.eu.org"
|
||||||
const val jmdkhMovieAPI = "https://tg.jmdkh.eu.org/0:"
|
const val jmdkhMovieAPI = "https://tg.jmdkh.eu.org/0:"
|
||||||
const val rubyMovieAPI = "https://upload.rubyshare111.workers.dev/0:"
|
const val rubyMovieAPI = "https://upload.rubyshare111.workers.dev/0:"
|
||||||
const val shinobiMovieAPI = "https://index.shinobicloud.cf/0:"
|
const val shinobiMovieAPI = "https://home.shinobicloud.cf/0:"
|
||||||
const val vitoenMovieAPI = "https://openmatte.vitoencodes.workers.dev/0:"
|
const val vitoenMovieAPI = "https://openmatte.vitoencodes.workers.dev/0:"
|
||||||
|
|
||||||
fun getType(t: String?): TvType {
|
fun getType(t: String?): TvType {
|
||||||
|
@ -794,6 +794,7 @@ open class SoraStream : TmdbProvider() {
|
||||||
res.imdbId,
|
res.imdbId,
|
||||||
res.id,
|
res.id,
|
||||||
res.title,
|
res.title,
|
||||||
|
res.airedYear ?: res.year,
|
||||||
res.season,
|
res.season,
|
||||||
res.episode,
|
res.episode,
|
||||||
subtitleCallback,
|
subtitleCallback,
|
||||||
|
|
|
@ -228,6 +228,7 @@ class SoraStreamLite : SoraStream() {
|
||||||
res.imdbId,
|
res.imdbId,
|
||||||
res.id,
|
res.id,
|
||||||
res.title,
|
res.title,
|
||||||
|
res.airedYear ?: res.year,
|
||||||
res.season,
|
res.season,
|
||||||
res.episode,
|
res.episode,
|
||||||
subtitleCallback,
|
subtitleCallback,
|
||||||
|
|
|
@ -10,6 +10,7 @@ import com.hexated.SoraStream.Companion.gdbot
|
||||||
import com.hexated.SoraStream.Companion.smashyStreamAPI
|
import com.hexated.SoraStream.Companion.smashyStreamAPI
|
||||||
import com.hexated.SoraStream.Companion.tvMoviesAPI
|
import com.hexated.SoraStream.Companion.tvMoviesAPI
|
||||||
import com.hexated.SoraStream.Companion.twoEmbedAPI
|
import com.hexated.SoraStream.Companion.twoEmbedAPI
|
||||||
|
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.mvvm.suspendSafeApiCall
|
import com.lagradost.cloudstream3.mvvm.suspendSafeApiCall
|
||||||
|
@ -724,6 +725,33 @@ fun Document.findTvMoviesIframe(): String? {
|
||||||
?.substringBefore("'>")
|
?.substringBefore("'>")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun searchWatchOnline(
|
||||||
|
title: String? = null,
|
||||||
|
season: Int? = null,
|
||||||
|
imdbId: String? = null,
|
||||||
|
tmdbId: Int? = null,
|
||||||
|
): NiceResponse? {
|
||||||
|
val mediaId = app.get(
|
||||||
|
if (season == null) {
|
||||||
|
"${watchOnlineAPI}/api/v1/movies?filters[q]=$title"
|
||||||
|
} else {
|
||||||
|
"${watchOnlineAPI}/api/v1/shows?filters[q]=$title"
|
||||||
|
}
|
||||||
|
).parsedSafe<WatchOnlineSearch>()?.items?.find {
|
||||||
|
it.imdb_id == imdbId || it.tmdb_id == tmdbId || it.imdb_id == imdbId?.removePrefix("tt")
|
||||||
|
}?.slug
|
||||||
|
|
||||||
|
return app.get(
|
||||||
|
fixUrl(
|
||||||
|
mediaId ?: return null, if (season == null) {
|
||||||
|
"${watchOnlineAPI}/movies/view"
|
||||||
|
} else {
|
||||||
|
"${watchOnlineAPI}/shows/view"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
suspend fun searchCrunchyrollAnimeId(title: String): String? {
|
suspend fun searchCrunchyrollAnimeId(title: String): String? {
|
||||||
val res = app.get("${consumetCrunchyrollAPI}/search/$title",timeout = 600L)
|
val res = app.get("${consumetCrunchyrollAPI}/search/$title",timeout = 600L)
|
||||||
.parsedSafe<ConsumetSearchResponse>()?.results
|
.parsedSafe<ConsumetSearchResponse>()?.results
|
||||||
|
@ -894,7 +922,7 @@ fun Headers.getGomoviesCookies(cookieKey: String = "set-cookie"): Map<String, St
|
||||||
}
|
}
|
||||||
|
|
||||||
fun String?.createSlug(): String? {
|
fun String?.createSlug(): String? {
|
||||||
return this?.replace(Regex("[^\\w\\s]"), "")
|
return this?.replace(Regex("[^\\w\\s-]"), "")
|
||||||
?.replace(" ", "-")
|
?.replace(" ", "-")
|
||||||
?.replace(Regex("( – )|( -)|(- )|(--)"), "-")
|
?.replace(Regex("( – )|( -)|(- )|(--)"), "-")
|
||||||
?.lowercase()
|
?.lowercase()
|
||||||
|
|
Loading…
Reference in a new issue