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 // use an integer for version numbers
version = 86 version = 87
cloudstream { cloudstream {

View file

@ -1189,34 +1189,33 @@ object SoraExtractor : SoraStream() {
season: Int? = null, season: Int? = null,
lastSeason: Int? = null, lastSeason: Int? = null,
episode: Int? = null, episode: Int? = null,
epsTitle: String? = null,
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
) { ) {
val url = if (season == null) { val slug = title.createSlug()?.replace("-", " ")
"$uhdmoviesAPI/download-${title.createSlug()}-$year" val url = "$uhdmoviesAPI/?s=$slug"
} else { var doc = app.get(url).document
val url = "$uhdmoviesAPI/?s=$title" if (doc.select("title").text() == "Just a moment...") {
var doc = app.get(url).document doc = app.get(url, interceptor = CloudflareKiller()).document
if (doc.select("title").text() == "Just a moment...") { }
doc = app.get(url, interceptor = CloudflareKiller()).document val scriptData = doc.select("div.row.gridlove-posts article").map {
} it.selectFirst("a")?.attr("href") to it.selectFirst("h1")?.text()
val scriptData = doc.select("div.row.gridlove-posts article").map {
it.selectFirst("a")?.attr("href") to it.selectFirst("h1")?.text()
}
(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 detailUrl = (if (scriptData.size == 1) {
scriptData.first()
} else {
scriptData.find { it.second?.filterMedia(title, year, lastSeason) == true }
})?.first
val detailDoc = app.get(detailUrl ?: return).document
val iframeList = detailDoc.select("div.entry-content p").map { it } 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) { if (season == null) {
it.text() to it.nextElementSibling()?.select("a")?.attr("href") it.text() to it.nextElementSibling()?.select("a")?.attr("href")
} else { } else {
it.text() to it.nextElementSibling()?.select("a:contains(Episode $episode)") it.text() to it.nextElementSibling()?.select("a:matches((Episode $episode)|($epsTitle))")
?.attr("href") ?.attr("href")
} }
}.filter { it.second?.contains(Regex("(https:)|(http:)")) == true } }.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 consumetCrunchyrollAPI = "https://api.consumet.org/anime/crunchyroll"
const val kissKhAPI = "https://kisskh.me" const val kissKhAPI = "https://kisskh.me"
const val lingAPI = "https://ling-online.net" 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 fwatayakoAPI = "https://5100.svetacdn.in"
const val gMoviesAPI = "https://gdrivemovies.xyz" const val gMoviesAPI = "https://gdrivemovies.xyz"
const val fdMoviesAPI = "https://freedrivemovie.lol" const val fdMoviesAPI = "https://freedrivemovie.lol"
@ -480,6 +480,7 @@ open class SoraStream : TmdbProvider() {
res.season, res.season,
res.lastSeason, res.lastSeason,
res.episode, res.episode,
res.epsTitle,
callback callback
) )
}, },

View file

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