diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt b/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt index eb10fd83..96de27d5 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraExtractor.kt @@ -1634,17 +1634,15 @@ object SoraExtractor : SoraStream() { app.get( url, referer = "https://smashystream.com/" ).document.select("div#_default-servers a.server").map { - it.attr("data-id") to it.text() + it.attr("data-url") to it.text() }.apmap { - when { - it.second.contains(Regex("(Player F|Player SE|Player N|Player D)")) -> { + when (it.second) { + "Player F" -> { invokeSmashyFfix(it.second, it.first, url, callback) } - - it.second.equals("Player FM", true) -> invokeSmashyFm( - it.second, it.first, url, callback - ) - + "Player D (Hindi)" -> { + invokeSmashyD(it.first, url, callback) + } else -> return@apmap } } diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraParser.kt b/SoraStream/src/main/kotlin/com/hexated/SoraParser.kt index 980ceb46..811f3d27 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraParser.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraParser.kt @@ -424,4 +424,13 @@ data class RidoSearch( data class SmashySources( @JsonProperty("sourceUrls") var sourceUrls: ArrayList? = arrayListOf(), @JsonProperty("subtitleUrls") var subtitleUrls: String? = null, +) + +data class SmashyDSources( + @JsonProperty("sourceUrls") var sourceUrls: ArrayList? = arrayListOf(), +) + +data class SmashyDSourcesUrls( + @JsonProperty("file") var file: String? = null, + @JsonProperty("title") var title: String? = null, ) \ No newline at end of file diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt b/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt index 9fe016b9..68b209e8 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraStream.kt @@ -536,7 +536,7 @@ open class SoraStream : TmdbProvider() { }, { if (!res.isAnime) invokeSmashyStream( - res.id, + res.imdbId, res.season, res.episode, subtitleCallback, diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraStreamLite.kt b/SoraStream/src/main/kotlin/com/hexated/SoraStreamLite.kt index ecc42e58..ae8deb22 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraStreamLite.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraStreamLite.kt @@ -144,7 +144,7 @@ class SoraStreamLite : SoraStream() { }, { if (!res.isAnime) invokeSmashyStream( - res.id, + res.imdbId, res.season, res.episode, subtitleCallback, diff --git a/SoraStream/src/main/kotlin/com/hexated/SoraUtils.kt b/SoraStream/src/main/kotlin/com/hexated/SoraUtils.kt index b9c0f488..6aba1337 100644 --- a/SoraStream/src/main/kotlin/com/hexated/SoraUtils.kt +++ b/SoraStream/src/main/kotlin/com/hexated/SoraUtils.kt @@ -45,7 +45,7 @@ import kotlin.collections.ArrayList import kotlin.math.min var watchflxCookies: Map? = null -var filmxyCookies: Map? = null +var filmxyCookies: Map? = null var sfServer: String? = null val encodedIndex = arrayOf( @@ -131,6 +131,7 @@ fun String.filterMedia(title: String?, yearNum: Int?, seasonNum: Int?): Boolean seasonNum > 1 -> this.contains(Regex("(?i)(Season\\s0?1-0?$seasonNum)|(S0?1-S?0?$seasonNum)")) && this.contains( Regex("(?i)($fixTitle)|($title)") ) + else -> this.contains(Regex("(?i)(Season\\s0?1)|(S0?1)")) && this.contains( Regex("(?i)($fixTitle)|($title)") ) && this.contains("$yearNum") @@ -449,22 +450,31 @@ suspend fun invokeSmashyFfix( ref: String, callback: (ExtractorLink) -> Unit, ) { - val res = app.get(url, referer = ref).text - val source = Regex("['\"]?file['\"]?:\\s*\"([^\"]+)").find(res)?.groupValues?.get(1) ?: return + val json = app.get(url, referer = ref, headers = mapOf("X-Requested-With" to "XMLHttpRequest")) + .parsedSafe() + json?.sourceUrls?.map { + M3u8Helper.generateM3u8( + "Smashy [$name]", + it, + "" + ).forEach(callback) + } - source.split(",").map { links -> - val quality = Regex("\\[(\\S+)]").find(links)?.groupValues?.getOrNull(1)?.trim() - val link = links.removePrefix("[$quality]").trim() - callback.invoke( - ExtractorLink( - "Smashy [$name]", - "Smashy [$name]", - decode(link).replace("\\/", "/"), - smashyStreamAPI, - getQualityFromName(quality), - INFER_TYPE, - ) - ) +} + +suspend fun invokeSmashyD( + url: String, + ref: String, + callback: (ExtractorLink) -> Unit, +) { + val json = app.get(url, referer = ref, headers = mapOf("X-Requested-With" to "XMLHttpRequest")) + .parsedSafe() + json?.sourceUrls?.apmap { + M3u8Helper.generateM3u8( + "Smashy [Player D ${it.title}]", + it.file ?: return@apmap, + "" + ).forEach(callback) } } @@ -492,6 +502,7 @@ suspend fun getDumpIdAndType(title: String?, year: Int?, season: Int?): Pair { it.name?.contains( "$title", @@ -501,6 +512,7 @@ suspend fun getDumpIdAndType(title: String?, year: Int?, season: Int?): Pair { it.name?.contains(Regex("(?i)$title\\s?($season|${season.toRomanNumeral()}|Season\\s$season)")) == true && it.releaseTime == "$year" && it.domainType == 1 } @@ -536,25 +548,26 @@ suspend fun invokeDrivetot( ) { val res = app.get(url) val data = res.document.select("form input").associate { it.attr("name") to it.attr("value") } - app.post(res.url, data = data, cookies = res.cookies).document.select("div.card-body a").apmap { ele -> - val href = base64Decode(ele.attr("href").substringAfterLast("/")).let { - if(it.contains("hubcloud.lol")) it.replace("hubcloud.lol", "hubcloud.in") else it - } - loadExtractor(href, "$hdmovies4uAPI/", subtitleCallback) { link -> - callback.invoke( - ExtractorLink( - link.source, - "${link.name} $tags [$size]", - link.url, - link.referer, - link.quality, - link.type, - link.headers, - link.extractorData + app.post(res.url, data = data, cookies = res.cookies).document.select("div.card-body a") + .apmap { ele -> + val href = base64Decode(ele.attr("href").substringAfterLast("/")).let { + if (it.contains("hubcloud.lol")) it.replace("hubcloud.lol", "hubcloud.in") else it + } + loadExtractor(href, "$hdmovies4uAPI/", subtitleCallback) { link -> + callback.invoke( + ExtractorLink( + link.source, + "${link.name} $tags [$size]", + link.url, + link.referer, + link.quality, + link.type, + link.headers, + link.extractorData + ) ) - ) + } } - } } suspend fun bypassBqrecipes(url: String): String? { @@ -773,10 +786,13 @@ suspend fun fetchSfServer(): String { return app.get("https://raw.githubusercontent.com/hexated/cloudstream-resources/main/sfmovies_server").text } -suspend fun getFilmxyCookies(url: String) = filmxyCookies ?: fetchFilmxyCookies(url).also { filmxyCookies = it } +suspend fun getFilmxyCookies(url: String) = + filmxyCookies ?: fetchFilmxyCookies(url).also { filmxyCookies = it } + suspend fun fetchFilmxyCookies(url: String): Map { - val defaultCookies = mutableMapOf("G_ENABLED_IDPS" to "google", "true_checker" to "1", "XID" to "1") + val defaultCookies = + mutableMapOf("G_ENABLED_IDPS" to "google", "true_checker" to "1", "XID" to "1") session.get( url, headers = mapOf( @@ -789,7 +805,10 @@ suspend fun fetchFilmxyCookies(url: String): Map { defaultCookies["PHPSESSID"] = phpsessid val userNonce = - app.get("$filmxyAPI/login/?redirect_to=$filmxyAPI/", cookies = defaultCookies).document.select("script") + app.get( + "$filmxyAPI/login/?redirect_to=$filmxyAPI/", + cookies = defaultCookies + ).document.select("script") .find { it.data().contains("var userNonce") }?.data()?.let { Regex("var\\suserNonce.*?\"(\\S+?)\";").find(it)?.groupValues?.get(1) } @@ -813,7 +832,8 @@ suspend fun fetchFilmxyCookies(url: String): Map { return cookieJar.plus(defaultCookies) } -suspend fun getWatchflxCookies() = watchflxCookies ?: fetchWatchflxCookies().also { watchflxCookies = it } +suspend fun getWatchflxCookies() = + watchflxCookies ?: fetchWatchflxCookies().also { watchflxCookies = it } suspend fun fetchWatchflxCookies(): Map { session.get(watchflxAPI) @@ -825,7 +845,8 @@ suspend fun fetchWatchflxCookies(): Map { "continue_as_temp" to "true" ), cookies = cookies, headers = mapOf("X-Requested-With" to "XMLHttpRequest") ) - return session.baseClient.cookieJar.loadForRequest(loginUrl.toHttpUrl()).associate { it.name to it.value } + return session.baseClient.cookieJar.loadForRequest(loginUrl.toHttpUrl()) + .associate { it.name to it.value } } fun Document.findTvMoviesIframe(): String? { @@ -1160,7 +1181,11 @@ fun String.decodePrimewireXor(key: String): String { fun vidsrctoDecrypt(text: String): String { val parse = Base64.decode(text.toByteArray(), Base64.URL_SAFE) val cipher = Cipher.getInstance("RC4") - cipher.init(Cipher.DECRYPT_MODE, SecretKeySpec("8z5Ag5wgagfsOuhz".toByteArray(), "RC4"), cipher.parameters) + cipher.init( + Cipher.DECRYPT_MODE, + SecretKeySpec("8z5Ag5wgagfsOuhz".toByteArray(), "RC4"), + cipher.parameters + ) return decode(cipher.doFinal(parse).toString(Charsets.UTF_8)) } @@ -1300,7 +1325,7 @@ fun isUpcoming(dateString: String?): Boolean { } } -fun getDate() : TmdbDate { +fun getDate(): TmdbDate { val formatter = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()) val calender = Calendar.getInstance() val today = formatter.format(calender.time)