mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
sora: fixed UHDMovies
This commit is contained in:
parent
2a09b5daf9
commit
b31a4c92e4
4 changed files with 30 additions and 28 deletions
|
@ -1,5 +1,5 @@
|
|||
// use an integer for version numbers
|
||||
version = 86
|
||||
version = 87
|
||||
|
||||
|
||||
cloudstream {
|
||||
|
|
|
@ -1189,34 +1189,33 @@ 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"
|
||||
var doc = app.get(url).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()
|
||||
}
|
||||
(if (scriptData.size == 1) {
|
||||
scriptData.first()
|
||||
} else {
|
||||
scriptData.find { it.second?.filterMedia(title, year, lastSeason) == true }
|
||||
})?.first
|
||||
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
|
||||
}
|
||||
val scriptData = doc.select("div.row.gridlove-posts article").map {
|
||||
it.selectFirst("a")?.attr("href") to it.selectFirst("h1")?.text()
|
||||
}
|
||||
|
||||
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 }
|
||||
.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 }
|
||||
|
|
|
@ -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
|
||||
)
|
||||
},
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue