From 46644dd49f1b74cd439a24d1d09dfa061b6cde37 Mon Sep 17 00:00:00 2001 From: hexated Date: Sat, 18 Feb 2023 21:56:08 +0700 Subject: [PATCH] sora: fixed few sources --- SoraStream/build.gradle.kts | 2 +- .../main/kotlin/com/hexated/SoraExtractor.kt | 80 ++++++++----------- .../src/main/kotlin/com/hexated/SoraStream.kt | 58 +++++++------- .../main/kotlin/com/hexated/SoraStreamLite.kt | 2 +- .../src/main/kotlin/com/hexated/SoraUtils.kt | 77 +++++++++++++++++- 5 files changed, 140 insertions(+), 79 deletions(-) diff --git a/SoraStream/build.gradle.kts b/SoraStream/build.gradle.kts index 741144e0..45c59574 100644 --- a/SoraStream/build.gradle.kts +++ b/SoraStream/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 90 +version = 91 cloudstream { diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt b/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt index a272ebc9..58e5e117 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt @@ -1611,21 +1611,16 @@ object SoraExtractor : SoraStream() { val media = json?.find { it.first() == "${title.createSlug()}-$year" } - media?.filter { it.startsWith("https://drive.google.com") }?.apmap { + media?.filter { it.startsWith("https://drive.google.com") || it.startsWith("https://cdn.moviesbay.live") }?.apmap { val index = media.indexOf(it) val size = media[index.minus(1)] val quality = media[index.minus(2)] val qualityName = media[index.minus(3)] - val gdriveLink = getDirectGdrive(it) - - val doc = app.get(gdriveLink).document - val form = doc.select("form#download-form").attr("action") - val uc = doc.select("input#uc-download-link").attr("value") - val link = app.post( - form, data = mapOf( - "uc-download-link" to uc - ) - ).url + val link = if(it.startsWith("https://drive.google.com")) { + getDirectGdrive(it) + } else { + it.removeSuffix("?a=view") + } callback.invoke( ExtractorLink( @@ -1745,22 +1740,25 @@ object SoraExtractor : SoraStream() { callback: (ExtractorLink) -> Unit ) { val url = if (season == null) { - "$rStreamAPI/Movies/$id/$id.mp4" + "$rStreamAPI/e/?tmdb=$id" } else { - "$rStreamAPI/Shows/$id/$season/$episode.mp4" + "$rStreamAPI/e/?tmdb=$id&s=$season&e=$episode" } - val referer = "https://remotestre.am/" - if (!app.get(url, referer = referer).isSuccessful) return + val res = app.get(url).text + val link = Regex("\"file\":\"(http.*?)\"").find(res)?.groupValues?.getOrNull(1) ?: return + + delay(1000) + if(!app.get(link, referer = mainUrl).isSuccessful) return - delay(4000) callback.invoke( ExtractorLink( "RStream", "RStream", - url, - referer, - Qualities.P720.value + link, + mainUrl, + Qualities.P720.value, + link.contains(".m3u8") ) ) } @@ -1902,38 +1900,24 @@ object SoraExtractor : SoraStream() { callback: (ExtractorLink) -> Unit, ) { val url = if (season == null) { - "$smashyStreamAPI/gtop/tv.php?imdb=$imdbId" + "$smashyStreamAPI/playere.php?imdb=$imdbId" } else { - "$smashyStreamAPI/gtop/tv.php?imdb=$imdbId&s=$season&e=$episode" + "$smashyStreamAPI/playere.php?imdb=$imdbId&season=$season&episode=$episode" } - val doc = app.get(url).document - val script = doc.selectFirst("script:containsData(var secret)")?.data() ?: return - val secret = - script.substringAfter("secret = \"").substringBefore("\";").let { base64Decode(it) } - val key = script.substringAfter("token = \"").substringBefore("\";") - delay(3000) - val source = app.get( - "$secret$key", - headers = mapOf( - "X-Requested-With" to "XMLHttpRequest" - ) - ).parsedSafe() ?: return - - val videoUrl = base64Decode(source.file ?: return) - val quality = - Regex("(\\d{3,4})[Pp]").find(videoUrl)?.groupValues?.getOrNull(1)?.toIntOrNull() - ?: Qualities.P720.value - callback.invoke( - ExtractorLink( - "SmashyStream", - "SmashyStream", - videoUrl, - "", - quality, - videoUrl.contains(".m3u8") - ) - ) + app.get(url).document.select("div#_default-servers a.server").map { + it.attr("data-id") to it.text() + }.apmap { + when { + it.first.contains("/flix") -> { + invokeSmashyOne(it.second, it.first, callback) + } + it.first.contains("/gtop") -> { + invokeSmashyTwo(it.second, it.first, callback) + } + else -> return@apmap + } + } } diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt b/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt index 5d1d0ce9..b2744272 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt @@ -29,6 +29,7 @@ import com.hexated.SoraExtractor.invokeFDMovies import com.hexated.SoraExtractor.invokeFlixon import com.hexated.SoraExtractor.invokeFwatayako import com.hexated.SoraExtractor.invokeGMovies +import com.hexated.SoraExtractor.invokeGomovies import com.hexated.SoraExtractor.invokeJsmovies import com.hexated.SoraExtractor.invokeKisskh import com.hexated.SoraExtractor.invokeLing @@ -104,7 +105,7 @@ open class SoraStream : TmdbProvider() { const val moviezAddAPI = "https://45.143.223.244" const val bollyMazaAPI = "https://b.bloginguru.info" const val moviesbayAPI = "https://moviesbay.live" - const val rStreamAPI = "https://fsa.remotestre.am" + const val rStreamAPI = "https://remotestre.am" const val flixonAPI = "https://flixon.ru" const val animeKaizokuAPI = "https://animekaizoku.com" const val movie123NetAPI = "https://ww7.0123movie.net" @@ -115,12 +116,12 @@ open class SoraStream : TmdbProvider() { const val chillmovies0API = "https://chill.aicirou.workers.dev/0:" // dead const val chillmovies1API = "https://chill.aicirou.workers.dev/1:" // dead const val gamMoviesAPI = "https://drive.gamick.workers.dev/0:" // dead - const val jsMoviesAPI = "https://jsupload.jnsbot.workers.dev/0:" + const val jsMoviesAPI = "https://jsupload.jnsbot.workers.dev/0:" // dead + const val xtremeMoviesAPI = "https://kartik19.xtrememirror0.workers.dev/0:" // dead const val blackMoviesAPI = "https://dl.blacklistedbois.workers.dev/0:" const val rinzryMoviesAPI = "https://rinzry.stream/0:" const val codexMoviesAPI = "https://packs.codexcloudx.tech/0:" const val edithxMoviesAPI = "https://index.edithx.ga/0:" - const val xtremeMoviesAPI = "https://kartik19.xtrememirror0.workers.dev/0:" const val papaonMovies1API = "https://m.papaonwork.workers.dev/0:" const val papaonMovies2API = "https://m.papaonwork.workers.dev/1:" const val dahmerMoviesAPI = "https://edytjedhgmdhm.abfhaqrhbnf.workers.dev" @@ -439,7 +440,7 @@ open class SoraStream : TmdbProvider() { ) }, { - invokeFilmxy(res.imdbId, res.season, res.episode, subtitleCallback, callback) + if (!res.isAnime) invokeFilmxy(res.imdbId, res.season, res.episode, subtitleCallback, callback) }, { invokeKimcartoon(res.title, res.season, res.episode, subtitleCallback, callback) @@ -623,17 +624,17 @@ open class SoraStream : TmdbProvider() { callback ) }, - { - if (!res.isAnime) invokeJsmovies( - jsMoviesAPI, - "JSMovies", - res.title, - res.year, - res.season, - res.episode, - callback - ) - }, +// { +// if (!res.isAnime) invokeJsmovies( +// jsMoviesAPI, +// "JSMovies", +// res.title, +// res.year, +// res.season, +// res.episode, +// callback +// ) +// }, { invokeRinzrymovies( rinzryMoviesAPI, @@ -669,17 +670,17 @@ open class SoraStream : TmdbProvider() { "Basic ZWRpdGg6amFydmlz" ) }, - { - if (!res.isAnime) invokeXtrememovies( - xtremeMoviesAPI, - "XtremeMovies", - res.title, - res.year, - res.season, - res.episode, - callback - ) - }, +// { +// if (!res.isAnime) invokeXtrememovies( +// xtremeMoviesAPI, +// "XtremeMovies", +// res.title, +// res.year, +// res.season, +// res.episode, +// callback +// ) +// }, { if (!res.isAnime) invokePapaonMovies1( papaonMovies1API, @@ -710,7 +711,10 @@ open class SoraStream : TmdbProvider() { res.episode, callback ) - } + }, + { + invokeGomovies(res.title, res.year, res.season, res.episode, callback) + }, ) return true diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraStreamLite.kt b/SoraStream/src/main/kotlin/com/hexated/SoraStreamLite.kt index 4c78eb31..f11fe178 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraStreamLite.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraStreamLite.kt @@ -148,7 +148,7 @@ class SoraStreamLite : SoraStream() { ) }, { - invokeFilmxy(res.imdbId, res.season, res.episode, subtitleCallback, callback) + if (!res.isAnime) invokeFilmxy(res.imdbId, res.season, res.episode, subtitleCallback, callback) }, { invokeKimcartoon(res.title, res.season, res.episode, subtitleCallback, callback) diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraUtils.kt b/SoraStream/src/main/kotlin/com/hexated/SoraUtils.kt index 42f29657..8a86cc93 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraUtils.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraUtils.kt @@ -5,6 +5,7 @@ import com.hexated.SoraStream.Companion.baymoviesAPI import com.hexated.SoraStream.Companion.consumetCrunchyrollAPI import com.hexated.SoraStream.Companion.filmxyAPI import com.hexated.SoraStream.Companion.gdbot +import com.hexated.SoraStream.Companion.smashyStreamAPI import com.hexated.SoraStream.Companion.tvMoviesAPI import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.APIHolder.getCaptchaToken @@ -324,14 +325,86 @@ suspend fun extractCovyn(url: String?): Pair? { return Pair(videoLink, size) } -fun getDirectGdrive(url: String): String { - return if (url.contains("&export=download")) { +suspend fun getDirectGdrive(url: String): String { + val fixUrl = if (url.contains("&export=download")) { url } else { "https://drive.google.com/uc?id=${ url.substringAfter("/d/").substringBefore("/") }&export=download" } + + val doc = app.get(fixUrl).document + val form = doc.select("form#download-form").attr("action") + val uc = doc.select("input#uc-download-link").attr("value") + return app.post( + form, data = mapOf( + "uc-download-link" to uc + ) + ).url + +} + +suspend fun invokeSmashyOne( + name: String, + url: String, + callback: (ExtractorLink) -> Unit, +) { + val script = app.get(url).document.selectFirst("script:containsData(player =)")?.data() ?: return + + val source = + Regex("file:\\s['\"](\\S+?)['|\"]").find(script)?.groupValues?.get( + 1 + ) ?: return + + source.split(",").map { links -> + val quality = Regex("\\[(\\d+)]").find(links)?.groupValues?.getOrNull(1)?.trim() + val link = links.removePrefix("[$quality]").trim() + callback.invoke( + ExtractorLink( + "Smashy [$name]", + "Smashy [$name]", + link, + smashyStreamAPI, + quality?.toIntOrNull() ?: return@map, + isM3u8 = link.contains(".m3u8"), + ) + ) + } + +} + +suspend fun invokeSmashyTwo( + name: String, + url: String, + callback: (ExtractorLink) -> Unit +) { + val doc = app.get(url).document + val script = doc.selectFirst("script:containsData(var secret)")?.data() ?: return + val secret = + script.substringAfter("secret = \"").substringBefore("\";").let { base64Decode(it) } + val key = script.substringAfter("token = \"").substringBefore("\";") + val source = app.get( + "$secret$key", + headers = mapOf( + "X-Requested-With" to "XMLHttpRequest" + ) + ).parsedSafe() ?: return + + val videoUrl = base64Decode(source.file ?: return) + val quality = + Regex("(\\d{3,4})[Pp]").find(videoUrl)?.groupValues?.getOrNull(1)?.toIntOrNull() + ?: Qualities.P720.value + callback.invoke( + ExtractorLink( + "Smashy [$name]", + "Smashy [$name]", + videoUrl, + "", + quality, + videoUrl.contains(".m3u8") + ) + ) } suspend fun bypassOuo(url: String?): String? {