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,
|
||||
tmdbId: Int? = null,
|
||||
title: String? = null,
|
||||
year: Int? = null,
|
||||
season: Int? = null,
|
||||
episode: Int? = null,
|
||||
subtitleCallback: (SubtitleFile) -> Unit,
|
||||
callback: (ExtractorLink) -> Unit,
|
||||
) {
|
||||
val id = imdbId?.removePrefix("tt")
|
||||
val slug = title.createSlug()
|
||||
val url = if(season == null) {
|
||||
"$watchOnlineAPI/api/v1/movies?filters[q]=$title"
|
||||
"$watchOnlineAPI/movies/view/$id-$slug-$year"
|
||||
} else {
|
||||
"$watchOnlineAPI/api/v1/shows?filters[q]=$title"
|
||||
"$watchOnlineAPI/shows/view/$id-$slug-$year"
|
||||
}
|
||||
|
||||
val baseUrl = if(season == null) {
|
||||
"$watchOnlineAPI/movies/view"
|
||||
} 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
|
||||
var res = app.get(url)
|
||||
if(!res.isSuccessful) res = searchWatchOnline(title, season, imdbId, tmdbId) ?: return
|
||||
|
||||
val doc = res.document
|
||||
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 {
|
||||
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)
|
||||
}?.attr("data-id-episode")
|
||||
} ?: return
|
||||
|
@ -2768,7 +2763,6 @@ object SoraExtractor : SoraStream() {
|
|||
)
|
||||
}
|
||||
|
||||
//TODO find better way
|
||||
val subtitles = json?.subtitles as ArrayList<HashMap<String, String>>
|
||||
|
||||
subtitles.map { sub ->
|
||||
|
|
|
@ -139,7 +139,7 @@ open class SoraStream : TmdbProvider() {
|
|||
const val tgarMovieAPI = "https://tgarchive.eu.org"
|
||||
const val jmdkhMovieAPI = "https://tg.jmdkh.eu.org/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:"
|
||||
|
||||
fun getType(t: String?): TvType {
|
||||
|
@ -794,6 +794,7 @@ open class SoraStream : TmdbProvider() {
|
|||
res.imdbId,
|
||||
res.id,
|
||||
res.title,
|
||||
res.airedYear ?: res.year,
|
||||
res.season,
|
||||
res.episode,
|
||||
subtitleCallback,
|
||||
|
|
|
@ -228,6 +228,7 @@ class SoraStreamLite : SoraStream() {
|
|||
res.imdbId,
|
||||
res.id,
|
||||
res.title,
|
||||
res.airedYear ?: res.year,
|
||||
res.season,
|
||||
res.episode,
|
||||
subtitleCallback,
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.hexated.SoraStream.Companion.gdbot
|
|||
import com.hexated.SoraStream.Companion.smashyStreamAPI
|
||||
import com.hexated.SoraStream.Companion.tvMoviesAPI
|
||||
import com.hexated.SoraStream.Companion.twoEmbedAPI
|
||||
import com.hexated.SoraStream.Companion.watchOnlineAPI
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.APIHolder.getCaptchaToken
|
||||
import com.lagradost.cloudstream3.mvvm.suspendSafeApiCall
|
||||
|
@ -724,6 +725,33 @@ fun Document.findTvMoviesIframe(): String? {
|
|||
?.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? {
|
||||
val res = app.get("${consumetCrunchyrollAPI}/search/$title",timeout = 600L)
|
||||
.parsedSafe<ConsumetSearchResponse>()?.results
|
||||
|
@ -894,7 +922,7 @@ fun Headers.getGomoviesCookies(cookieKey: String = "set-cookie"): Map<String, St
|
|||
}
|
||||
|
||||
fun String?.createSlug(): String? {
|
||||
return this?.replace(Regex("[^\\w\\s]"), "")
|
||||
return this?.replace(Regex("[^\\w\\s-]"), "")
|
||||
?.replace(" ", "-")
|
||||
?.replace(Regex("( – )|( -)|(- )|(--)"), "-")
|
||||
?.lowercase()
|
||||
|
|
Loading…
Reference in a new issue