diff --git a/IdlixProvider/build.gradle.kts b/IdlixProvider/build.gradle.kts index 63fef982..f7ae78c8 100644 --- a/IdlixProvider/build.gradle.kts +++ b/IdlixProvider/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 15 +version = 16 cloudstream { diff --git a/IdlixProvider/src/main/kotlin/com/hexated/IdlixProvider.kt b/IdlixProvider/src/main/kotlin/com/hexated/IdlixProvider.kt index d103bad9..76bb017c 100644 --- a/IdlixProvider/src/main/kotlin/com/hexated/IdlixProvider.kt +++ b/IdlixProvider/src/main/kotlin/com/hexated/IdlixProvider.kt @@ -4,13 +4,9 @@ import com.fasterxml.jackson.annotation.JsonProperty import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.LoadResponse.Companion.addActors import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer -import com.lagradost.cloudstream3.mvvm.safeApiCall +import com.lagradost.cloudstream3.extractors.helper.AesHelper import com.lagradost.cloudstream3.network.CloudflareKiller import com.lagradost.cloudstream3.utils.* -import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson -import okhttp3.Interceptor -import okhttp3.Response -import org.jsoup.Jsoup import org.jsoup.nodes.Element import java.net.URI @@ -22,7 +18,6 @@ class IdlixProvider : MainAPI() { override var lang = "id" override val hasDownloadSupport = true private val cloudflareKiller by lazy { CloudflareKiller() } - private val interceptor by lazy { CloudflareInterceptor(cloudflareKiller) } override val supportedTypes = setOf( TvType.Movie, TvType.TvSeries, @@ -30,17 +25,15 @@ class IdlixProvider : MainAPI() { TvType.AsianDrama ) - private val key = "\\x5a\\x6d\\x5a\\x6c\\x4e\\x7a\\x55\\x79\\x4d\\x54\\x56\\x6a\\x5a\\x47\\x52\\x69\\x5a\\x44\\x55\\x30\\x5a\\x6d\\x59\\x35\\x4f\\x57\\x45\\x33\\x4d\\x44\\x4a\\x69\\x4e\\x32\\x4a\\x6c\\x4f\\x54\\x42\\x6c\\x4e\\x7a\\x49\\x3d" - override val mainPage = mainPageOf( "$mainUrl/" to "Featured", "$mainUrl/trending/page/?get=movies" to "Trending Movies", "$mainUrl/trending/page/?get=tv" to "Trending TV Series", "$mainUrl/movie/page/" to "Movie Terbaru", "$mainUrl/tvseries/page/" to "TV Series Terbaru", - "$mainUrl/network/netflix/page/" to "Netflix", - "$mainUrl/genre/anime/page/" to "Anime", - "$mainUrl/genre/drama-korea/page/" to "Drama Korea", +// "$mainUrl/network/netflix/page/" to "Netflix", +// "$mainUrl/genre/anime/page/" to "Anime", +// "$mainUrl/genre/drama-korea/page/" to "Drama Korea", ) private fun getBaseUrl(url: String): String { @@ -56,9 +49,9 @@ class IdlixProvider : MainAPI() { val url = request.data.split("?") val nonPaged = request.name == "Featured" && page <= 1 val req = if (nonPaged) { - app.get(request.data, interceptor = interceptor) + app.get(request.data) } else { - app.get("${url.first()}$page/?${url.lastOrNull()}", interceptor = interceptor) + app.get("${url.first()}$page/?${url.lastOrNull()}") } mainUrl = getBaseUrl(req.url) val document = req.document @@ -79,11 +72,13 @@ class IdlixProvider : MainAPI() { title = Regex("(.+?)-season").find(title)?.groupValues?.get(1).toString() "$mainUrl/tvseries/$title" } + uri.contains("/season/") -> { var title = uri.substringAfter("$mainUrl/season/") title = Regex("(.+?)-season").find(title)?.groupValues?.get(1).toString() "$mainUrl/tvseries/$title" } + else -> { uri } @@ -98,13 +93,12 @@ class IdlixProvider : MainAPI() { return newMovieSearchResponse(title, href, TvType.Movie) { this.posterUrl = posterUrl this.quality = quality - posterHeaders = cloudflareKiller.getCookieHeaders(mainUrl).toMap() } } override suspend fun search(query: String): List { - val req = app.get("$mainUrl/search/$query", interceptor = interceptor) + val req = app.get("$mainUrl/search/$query") mainUrl = getBaseUrl(req.url) val document = req.document return document.select("div.result-item").map { @@ -114,13 +108,12 @@ class IdlixProvider : MainAPI() { val posterUrl = it.selectFirst("img")!!.attr("src").toString() newMovieSearchResponse(title, href, TvType.TvSeries) { this.posterUrl = posterUrl - posterHeaders = cloudflareKiller.getCookieHeaders(mainUrl).toMap() } } } override suspend fun load(url: String): LoadResponse { - val request = app.get(url, interceptor = interceptor, referer = "$directUrl/") + val request = app.get(url) directUrl = getBaseUrl(request.url) val document = request.document val title = @@ -149,7 +142,6 @@ class IdlixProvider : MainAPI() { val recPosterUrl = it.selectFirst("img")?.attr("src").toString() newTvSeriesSearchResponse(recName, recHref, TvType.TvSeries) { this.posterUrl = recPosterUrl - posterHeaders = cloudflareKiller.getCookieHeaders(mainUrl).toMap() } } @@ -179,7 +171,6 @@ class IdlixProvider : MainAPI() { addActors(actors) this.recommendations = recommendations addTrailer(trailer) - posterHeaders = cloudflareKiller.getCookieHeaders(mainUrl).toMap() } } else { newMovieLoadResponse(title, url, TvType.Movie, url) { @@ -191,7 +182,6 @@ class IdlixProvider : MainAPI() { addActors(actors) this.recommendations = recommendations addTrailer(trailer) - posterHeaders = cloudflareKiller.getCookieHeaders(mainUrl).toMap() } } } @@ -203,114 +193,53 @@ class IdlixProvider : MainAPI() { callback: (ExtractorLink) -> Unit ): Boolean { - val document = app.get(data, interceptor = interceptor, referer = "$directUrl/").document - val id = document.select("meta#dooplay-ajax-counter").attr("data-postid") - val type = if (data.contains("/movie/")) "movie" else "tv" - + val document = app.get(data).document document.select("ul#playeroptionsul > li").map { - it.attr("data-nume") - }.apmap { nume -> - safeApiCall { - val source = app.post( - url = "$directUrl/wp-admin/admin-ajax.php", data = mapOf( - "action" to "doo_player_ajax", "post" to id, "nume" to nume, "type" to type - ), headers = mapOf("X-Requested-With" to "XMLHttpRequest"), referer = data, interceptor = interceptor - ).let { tryParseJson(it.text) } ?: return@safeApiCall - - val password = if(source.key?.startsWith("\\x") == true) source.key else key - var decrypted = AesHelper.cryptoAESHandler(source.embed_url, password.toByteArray(), false)?.fixBloat() ?: return@safeApiCall - - if (decrypted.startsWith("https://uservideo.xyz")) { - decrypted = app.get(decrypted).document.select("iframe").attr("src") - } - - getUrl(decrypted, "$directUrl/", subtitleCallback, callback) + Triple( + it.attr("data-post"), + it.attr("data-nume"), + it.attr("data-type") + ) + }.apmap { (id, nume, type) -> + val json = app.post( + url = "$directUrl/wp-admin/admin-ajax.php", data = mapOf( + "action" to "doo_player_ajax", "post" to id, "nume" to nume, "type" to type + ), referer = data, headers = mapOf("Accept" to "*/*", "X-Requested-With" to "XMLHttpRequest") + ).parsedSafe() ?: return@apmap + val metrix = AppUtils.parseJson(json.embed_url).m + val password = createKey(json.key, metrix) + val decrypted = AesHelper.cryptoAESHandler(json.embed_url, password.toByteArray(), false)?.fixBloat() ?: return@apmap + when { + !decrypted.contains("youtube") -> loadExtractor(decrypted, "$directUrl/", subtitleCallback, callback) + else -> return@apmap } } return true } - class CloudflareInterceptor(private val cloudflareKiller: CloudflareKiller): Interceptor { - override fun intercept(chain: Interceptor.Chain): Response { - val request = chain.request() - val response = chain.proceed(request) - val doc = Jsoup.parse(response.peekBody(1024 * 1024).string()) - if (doc.select("title").text() == "Just a moment...") { - return cloudflareKiller.intercept(chain) - } - return response + private fun createKey(r: String, m: String): String { + val rList = r.split("\\x").toTypedArray() + var n = "" + val decodedM = String(base64Decode(m.split("").reversed().joinToString("")).toCharArray()) + for (s in decodedM.split("|")) { + n += "\\x" + rList[Integer.parseInt(s) + 1] } + return n } - private fun String.fixBloat() : String { + private fun String.fixBloat(): String { return this.replace("\"", "").replace("\\", "") } - private suspend fun getUrl( - url: String, - referer: String?, - subtitleCallback: (SubtitleFile) -> Unit, - callback: (ExtractorLink) -> Unit - ) { - val document = app.get(url, referer = referer).document - val hash = url.split("/").last().substringAfter("data=") - - val m3uLink = app.post( - url = "$mainUrl/player/index.php?data=$hash&do=getVideo", - data = mapOf("hash" to hash, "r" to "$referer"), - referer = referer, - headers = mapOf("X-Requested-With" to "XMLHttpRequest") - ).parsed().videoSource - - M3u8Helper.generateM3u8( - this.name, - m3uLink, - "$referer", - ).forEach(callback) - - - document.select("script").map { script -> - if (script.data().contains("eval(function(p,a,c,k,e,d)")) { - val subData = - getAndUnpack(script.data()).substringAfter("\"tracks\":[").substringBefore("],") - tryParseJson>("[$subData]")?.map { subtitle -> - subtitleCallback.invoke( - SubtitleFile( - getLanguage(subtitle.label ?: ""), - subtitle.file - ) - ) - } - } - } - } - - private fun getLanguage(str: String): String { - return when { - str.contains("indonesia", true) || str - .contains("bahasa", true) -> "Indonesian" - else -> str - } - } - - data class ResponseSource( - @JsonProperty("hls") val hls: Boolean, - @JsonProperty("videoSource") val videoSource: String, - @JsonProperty("securedLink") val securedLink: String?, - ) - - data class Tracks( - @JsonProperty("kind") val kind: String?, - @JsonProperty("file") val file: String, - @JsonProperty("label") val label: String?, - ) - data class ResponseHash( @JsonProperty("embed_url") val embed_url: String, - @JsonProperty("key") val key: String?, - @JsonProperty("type") val type: String?, + @JsonProperty("key") val key: String, + ) + + data class AesData( + @JsonProperty("m") val m: String, )