From eff3abf9f5f3fa3d0ff6cadef5887a8550b6d476 Mon Sep 17 00:00:00 2001 From: Son Goku <39613333+gemboxhost@users.noreply.github.com> Date: Tue, 29 Aug 2023 09:07:34 +0800 Subject: [PATCH] Delete IdlixProvider.kt --- .../main/kotlin/com/hexated/IdlixProvider.kt | 232 ------------------ 1 file changed, 232 deletions(-) delete mode 100644 IdlixProvider/src/main/kotlin/com/hexated/IdlixProvider.kt diff --git a/IdlixProvider/src/main/kotlin/com/hexated/IdlixProvider.kt b/IdlixProvider/src/main/kotlin/com/hexated/IdlixProvider.kt deleted file mode 100644 index 99e62b23..00000000 --- a/IdlixProvider/src/main/kotlin/com/hexated/IdlixProvider.kt +++ /dev/null @@ -1,232 +0,0 @@ -package com.hexated - -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.utils.* -import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson -import com.lagradost.nicehttp.Requests -import com.lagradost.nicehttp.Session -import org.jsoup.nodes.Element -import java.net.URI - -class IdlixProvider : MainAPI() { - override var mainUrl = "https://tv.idlixplus.net" - private var directUrl = mainUrl - override var name = "Idlix" - override val hasMainPage = true - override var lang = "id" - override val hasDownloadSupport = true - private val session = Session(Requests().baseClient) - override val supportedTypes = setOf( - TvType.Movie, - TvType.TvSeries, - TvType.Anime, - TvType.AsianDrama - ) - - 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", - ) - - private fun getBaseUrl(url: String): String { - return URI(url).let { - "${it.scheme}://${it.host}" - } - } - - override suspend fun getMainPage( - page: Int, - request: MainPageRequest - ): HomePageResponse { - val url = request.data.split("?") - val nonPaged = request.name == "Featured" && page <= 1 - val req = if (nonPaged) { - session.get(request.data) - } else { - session.get("${url.first()}$page/?${url.lastOrNull()}") - } - mainUrl = getBaseUrl(req.url) - val document = req.document - val home = (if (nonPaged) { - document.select("div.items.featured article") - } else { - document.select("div.items.full article, div#archive-content article") - }).mapNotNull { - it.toSearchResult() - } - return newHomePageResponse(request.name, home) - } - - private fun getProperLink(uri: String): String { - return when { - uri.contains("/episode/") -> { - var title = uri.substringAfter("$mainUrl/episode/") - 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 - } - } - } - - private fun Element.toSearchResult(): SearchResponse { - val title = this.selectFirst("h3 > a")!!.text().replace(Regex("\\(\\d{4}\\)"), "").trim() - val href = getProperLink(this.selectFirst("h3 > a")!!.attr("href")) - val posterUrl = this.select("div.poster > img").attr("src").toString() - val quality = getQualityFromString(this.select("span.quality").text()) - return newMovieSearchResponse(title, href, TvType.Movie) { - this.posterUrl = posterUrl - this.quality = quality - } - - } - - override suspend fun search(query: String): List { - val req = session.get("$mainUrl/search/$query") - mainUrl = getBaseUrl(req.url) - val document = req.document - return document.select("div.result-item").map { - val title = - it.selectFirst("div.title > a")!!.text().replace(Regex("\\(\\d{4}\\)"), "").trim() - val href = getProperLink(it.selectFirst("div.title > a")!!.attr("href")) - val posterUrl = it.selectFirst("img")!!.attr("src").toString() - newMovieSearchResponse(title, href, TvType.TvSeries) { - this.posterUrl = posterUrl - } - } - } - - override suspend fun load(url: String): LoadResponse { - val request = session.get(url) - directUrl = getBaseUrl(request.url) - val document = request.document - val title = - document.selectFirst("div.data > h1")?.text()?.replace(Regex("\\(\\d{4}\\)"), "") - ?.trim().toString() - val poster = document.select("div.poster > img").attr("src").toString() - val tags = document.select("div.sgeneros > a").map { it.text() } - - val year = Regex(",\\s?(\\d+)").find( - document.select("span.date").text().trim() - )?.groupValues?.get(1).toString().toIntOrNull() - val tvType = if (document.select("ul#section > li:nth-child(1)").text().contains("Episodes") - ) TvType.TvSeries else TvType.Movie - val description = document.select("div.wp-content > p").text().trim() - val trailer = document.selectFirst("div.embed iframe")?.attr("src") - val rating = - document.selectFirst("span.dt_rating_vgs")?.text()?.toRatingInt() - val actors = document.select("div.persons > div[itemprop=actor]").map { - Actor(it.select("meta[itemprop=name]").attr("content"), it.select("img").attr("src")) - } - - val recommendations = document.select("div.owl-item").map { - val recName = - it.selectFirst("a")!!.attr("href").toString().removeSuffix("/").split("/").last() - val recHref = it.selectFirst("a")!!.attr("href") - val recPosterUrl = it.selectFirst("img")?.attr("src").toString() - newTvSeriesSearchResponse(recName, recHref, TvType.TvSeries) { - this.posterUrl = recPosterUrl - } - } - - return if (tvType == TvType.TvSeries) { - val episodes = document.select("ul.episodios > li").map { - val href = it.select("a").attr("href") - val name = fixTitle(it.select("div.episodiotitle > a").text().trim()) - val image = it.select("div.imagen > img").attr("src") - val episode = it.select("div.numerando").text().replace(" ", "").split("-").last() - .toIntOrNull() - val season = it.select("div.numerando").text().replace(" ", "").split("-").first() - .toIntOrNull() - Episode( - href, - name, - season, - episode, - image - ) - } - newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) { - this.posterUrl = poster - this.year = year - this.plot = description - this.tags = tags - this.rating = rating - addActors(actors) - this.recommendations = recommendations - addTrailer(trailer) - } - } else { - newMovieLoadResponse(title, url, TvType.Movie, url) { - this.posterUrl = poster - this.year = year - this.plot = description - this.tags = tags - this.rating = rating - addActors(actors) - this.recommendations = recommendations - addTrailer(trailer) - } - } - } - - override suspend fun loadLinks( - data: String, - isCasting: Boolean, - subtitleCallback: (SubtitleFile) -> Unit, - callback: (ExtractorLink) -> Unit - ): Boolean { - - val document = session.get(data).document - val id = document.select("meta#dooplay-ajax-counter").attr("data-postid") - val type = if (data.contains("/movie/")) "movie" else "tv" - - document.select("ul#playeroptionsul > li").map { - it.attr("data-nume") - }.apmap { nume -> - safeApiCall { - var source = session.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 - ).let { tryParseJson(it.text) }?.embed_url ?: return@safeApiCall - - if (source.startsWith("https://uservideo.xyz")) { - source = app.get(source).document.select("iframe").attr("src") - } - loadExtractor(source, directUrl, subtitleCallback, callback) - - } - } - - return true - } - - data class ResponseHash( - @JsonProperty("embed_url") val embed_url: String, - @JsonProperty("type") val type: String?, - ) - -}