sora: small fix in UHDMovies

This commit is contained in:
hexated 2023-03-07 21:05:52 +07:00
parent a11d9071e5
commit 7ea47f4e4b
4 changed files with 34 additions and 42 deletions

View file

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

View file

@ -1157,7 +1157,6 @@ 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 slug = title.createSlug()?.replace("-", " ") val slug = title.createSlug()?.replace("-", " ")
@ -1184,7 +1183,7 @@ object SoraExtractor : SoraStream() {
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() it.text() to it.nextElementSibling()
?.select("a:matches((Episode $episode)|($epsTitle))") ?.select("a")?.find { child -> child.select("span").text().equals("Episode $episode", true) }
?.attr("href") ?.attr("href")
} }
}.filter { it.second?.contains(Regex("(https:)|(http:)")) == true } }.filter { it.second?.contains(Regex("(https:)|(http:)")) == true }
@ -1215,10 +1214,7 @@ object SoraExtractor : SoraStream() {
sources.apmap { (quality, link) -> sources.apmap { (quality, link) ->
val driveLink = bypassHrefli(link ?: return@apmap null) val driveLink = bypassHrefli(link ?: return@apmap null)
val base = getBaseUrl(driveLink ?: return@apmap null) val base = getBaseUrl(driveLink ?: return@apmap null)
val resDoc = app.get(driveLink).text.substringAfter("replace(\"") val resDoc = app.get(driveLink).document
.substringBefore("\")").let {
app.get(fixUrl(it, base)).document
}
val bitLink = resDoc.selectFirst("a.btn.btn-outline-success")?.attr("href") val bitLink = resDoc.selectFirst("a.btn.btn-outline-success")?.attr("href")
val downloadLink = if (bitLink.isNullOrEmpty()) { val downloadLink = if (bitLink.isNullOrEmpty()) {
val backupIframe = resDoc.select("a.btn.btn-outline-warning").attr("href") val backupIframe = resDoc.select("a.btn.btn-outline-warning").attr("href")

View file

@ -97,7 +97,7 @@ open class SoraStream : TmdbProvider() {
const val filmxyAPI = "https://www.filmxy.vip" const val filmxyAPI = "https://www.filmxy.vip"
const val kimcartoonAPI = "https://kimcartoon.li" const val kimcartoonAPI = "https://kimcartoon.li"
const val xMovieAPI = "https://xemovies.to" const val xMovieAPI = "https://xemovies.to"
const val haikeiFlixhqAPI = "https://api.haikei.xyz/movies/flixhq" // disabled const val haikeiFlixhqAPI = "https://api.haikei.xyz/movies/flixhq" // disabled due to rate limit
const val consumetZoroAPI = "https://api.consumet.org/anime/zoro" const val consumetZoroAPI = "https://api.consumet.org/anime/zoro"
const val consumetCrunchyrollAPI = "https://cronchy.consumet.stream" const val consumetCrunchyrollAPI = "https://cronchy.consumet.stream"
const val kickassanimeAPI = "https://www2.kickassanime.ro" // disabled due to consumet const val kickassanimeAPI = "https://www2.kickassanime.ro" // disabled due to consumet
@ -503,7 +503,6 @@ open class SoraStream : TmdbProvider() {
res.season, res.season,
res.lastSeason, res.lastSeason,
res.episode, res.episode,
res.epsTitle,
callback callback
) )
}, },

View file

@ -158,17 +158,11 @@ suspend fun extractMirrorUHD(url: String, ref: String): String? {
downLink = baseDoc.getMirrorLink() downLink = baseDoc.getMirrorLink()
} }
} }
if (downLink?.contains(".mkv") == true || downLink?.contains(".mp4") == true) return downLink return if (downLink?.contains("workers.dev") == true) downLink else base64Decode(
val downPage = app.get(downLink ?: return null).document downLink?.substringAfter(
return downPage.selectFirst("form[method=post] a.btn.btn-success") "download?url="
?.attr("onclick")?.substringAfter("Openblank('")?.substringBefore("')") ?: run { ) ?: return null
val mirror = downPage.selectFirst("form[method=post] a.btn.btn-primary") )
?.attr("onclick")?.substringAfter("Openblank('")?.substringBefore("')")
app.get(
mirror ?: return null
).document.selectFirst("script:containsData(input.value =)")
?.data()?.substringAfter("input.value = '")?.substringBefore("';")
}
} }
suspend fun extractBackupUHD(url: String): String? { suspend fun extractBackupUHD(url: String): String? {
@ -619,31 +613,34 @@ suspend fun bypassFdAds(url: String?): String? {
} }
suspend fun bypassHrefli(url: String): String? { suspend fun bypassHrefli(url: String): String? {
var res = app.get(url.removePrefix("https://href.li/?")) val postUrl = url.substringBefore("?id=").substringAfter("/?")
(1..2).forEach { _ -> val res = app.post(
val document = res.document postUrl, data = mapOf(
val nextUrl = document.select("form").attr("action") "_wp_http" to url.substringAfter("?id=")
val data = document.select("form input").mapNotNull {
it.attr("name") to it.attr("value")
}.toMap()
res = app.post(
nextUrl,
data = data,
) )
} ).document
val script = res.document.selectFirst("script:containsData(verify_button)")?.data()
val goUrl = script?.substringAfter("\"href\",\"")?.substringBefore("\")")
val cookies =
Regex("sumitbot_\\('(\\S+?)',\n|.?'(\\S+?)',").findAll(script ?: return null).map {
it.groupValues[2]
}.toList().let {
mapOf(it.first() to it.last())
}.ifEmpty { return null }
return app.get( val link = res.select("form#landing").attr("action")
goUrl ?: return null, val wpHttp = res.select("input[name=_wp_http2]").attr("value")
cookies = cookies val token = res.select("input[name=token]").attr("value")
val blogRes = app.post(
link, data = mapOf(
"_wp_http2" to wpHttp,
"token" to token
)
).text
val skToken = blogRes.substringAfter("?go=").substringBefore("\"")
val driveUrl = app.get(
"$postUrl?go=$skToken", cookies = mapOf(
skToken to wpHttp
)
).document.selectFirst("meta[http-equiv=refresh]")?.attr("content")?.substringAfter("url=") ).document.selectFirst("meta[http-equiv=refresh]")?.attr("content")?.substringAfter("url=")
val path = app.get(driveUrl ?: return null).text.substringAfter("replace(\"")
.substringBefore("\")")
if (path == "/404") return null
return fixUrl(path, getBaseUrl(driveUrl))
} }
suspend fun getTvMoviesServer(url: String, season: Int?, episode: Int?): Pair<String, String?>? { suspend fun getTvMoviesServer(url: String, season: Int?, episode: Int?): Pair<String, String?>? {