sora: fixed UHDMovies

This commit is contained in:
hexated 2023-02-08 11:50:33 +07:00
parent 2a09b5daf9
commit b31a4c92e4
4 changed files with 30 additions and 28 deletions

View file

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

View file

@ -1189,12 +1189,11 @@ object SoraExtractor : SoraStream() {
season: Int? = null,
lastSeason: Int? = null,
episode: Int? = null,
epsTitle: String? = null,
callback: (ExtractorLink) -> Unit
) {
val url = if (season == null) {
"$uhdmoviesAPI/download-${title.createSlug()}-$year"
} else {
val url = "$uhdmoviesAPI/?s=$title"
val slug = title.createSlug()?.replace("-", " ")
val url = "$uhdmoviesAPI/?s=$slug"
var doc = app.get(url).document
if (doc.select("title").text() == "Just a moment...") {
doc = app.get(url, interceptor = CloudflareKiller()).document
@ -1202,21 +1201,21 @@ object SoraExtractor : SoraStream() {
val scriptData = doc.select("div.row.gridlove-posts article").map {
it.selectFirst("a")?.attr("href") to it.selectFirst("h1")?.text()
}
(if (scriptData.size == 1) {
val detailUrl = (if (scriptData.size == 1) {
scriptData.first()
} else {
scriptData.find { it.second?.filterMedia(title, year, lastSeason) == true }
})?.first
}
val detailDoc = app.get(url ?: return).document
val detailDoc = app.get(detailUrl ?: return).document
val iframeList = detailDoc.select("div.entry-content p").map { it }
.filter { it.text().filterIframe(season, lastSeason, year) }.mapNotNull {
.filter { it.text().filterIframe(season, lastSeason, year, title) }.mapNotNull {
if (season == null) {
it.text() to it.nextElementSibling()?.select("a")?.attr("href")
} else {
it.text() to it.nextElementSibling()?.select("a:contains(Episode $episode)")
it.text() to it.nextElementSibling()?.select("a:matches((Episode $episode)|($epsTitle))")
?.attr("href")
}
}.filter { it.second?.contains(Regex("(https:)|(http:)")) == true }

View file

@ -96,7 +96,7 @@ open class SoraStream : TmdbProvider() {
const val consumetCrunchyrollAPI = "https://api.consumet.org/anime/crunchyroll"
const val kissKhAPI = "https://kisskh.me"
const val lingAPI = "https://ling-online.net"
const val uhdmoviesAPI = "https://uhdmovies.org.in"
const val uhdmoviesAPI = "https://uhdmovies.world"
const val fwatayakoAPI = "https://5100.svetacdn.in"
const val gMoviesAPI = "https://gdrivemovies.xyz"
const val fdMoviesAPI = "https://freedrivemovie.lol"
@ -480,6 +480,7 @@ open class SoraStream : TmdbProvider() {
res.season,
res.lastSeason,
res.episode,
res.epsTitle,
callback
)
},

View file

@ -38,7 +38,10 @@ data class FilmxyCookies(
val wSec: String? = null,
)
fun String.filterIframe(seasonNum: Int?, lastSeason: Int?, year: Int?): Boolean {
fun String.filterIframe(seasonNum: Int?, lastSeason: Int?, year: Int?, title: String?): Boolean {
val slug = title.createSlug()
val dotSlug = slug?.replace("-", ".")
val spaceSlug = slug?.replace("-", " ")
return if (seasonNum != null) {
if (lastSeason == 1) {
this.contains(Regex("(?i)(S0?$seasonNum)|(Season\\s0?$seasonNum)|(\\d{3,4}p)")) && !this.contains(
@ -52,24 +55,23 @@ fun String.filterIframe(seasonNum: Int?, lastSeason: Int?, year: Int?): Boolean
)
}
} else {
this.contains("$year", true) && !this.contains("Download", true)
this.contains(Regex("(?i)($year)|($dotSlug)|($spaceSlug)")) && !this.contains("Download", true)
}
}
fun String.filterMedia(title: String?, yearNum: Int?, seasonNum: Int?): Boolean {
val fixTitle = title.createSlug()?.replace("-", " ")
return if (seasonNum != null) {
when {
seasonNum > 1 -> this.contains(Regex("(?i)(Season\\s0?1-0?$seasonNum)|(S0?1-S?0?$seasonNum)")) && this.contains(
"$title",
true
Regex("(?i)($fixTitle)|($title)")
)
else -> this.contains(Regex("(?i)(Season\\s0?1)|(S0?1)")) && this.contains(
"$title",
true
Regex("(?i)($fixTitle)|($title)")
) && this.contains("$yearNum")
}
} else {
this.contains("$title", true) && this.contains("$yearNum")
this.contains(Regex("(?i)($fixTitle)|($title)")) && this.contains("$yearNum")
}
}