From f7af04689b312c8c23d3a7210d10e80ae61becd5 Mon Sep 17 00:00:00 2001 From: Antony Date: Mon, 22 Aug 2022 22:13:04 +0200 Subject: [PATCH] Try fix tantifilm --- TantiFilmProvider/build.gradle.kts | 2 +- .../kotlin/com/lagradost/TantiFilmProvider.kt | 20 +++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/TantiFilmProvider/build.gradle.kts b/TantiFilmProvider/build.gradle.kts index 7106ffe..f98a6f1 100644 --- a/TantiFilmProvider/build.gradle.kts +++ b/TantiFilmProvider/build.gradle.kts @@ -16,7 +16,7 @@ cloudstream { * 2: Slow * 3: Beta only * */ - status = 0 // will be 3 if unspecified + status = 1 // will be 3 if unspecified tvTypes = listOf( "TvSeries", "Movie", diff --git a/TantiFilmProvider/src/main/kotlin/com/lagradost/TantiFilmProvider.kt b/TantiFilmProvider/src/main/kotlin/com/lagradost/TantiFilmProvider.kt index f030606..89734b8 100644 --- a/TantiFilmProvider/src/main/kotlin/com/lagradost/TantiFilmProvider.kt +++ b/TantiFilmProvider/src/main/kotlin/com/lagradost/TantiFilmProvider.kt @@ -4,6 +4,8 @@ import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.loadExtractor +import com.lagradost.cloudstream3.network.CloudflareKiller +import okhttp3.Interceptor class TantifilmProvider : MainAPI() { @@ -28,7 +30,8 @@ class TantifilmProvider : MainAPI() { request : MainPageRequest ): HomePageResponse { val url = request.data + page - val soup = app.get(url).document + val interceptor = CloudflareKiller() + val soup = app.get(url, interceptor = interceptor).document val home = soup.select("div.media3").map { val title = it.selectFirst("p")!!.text().substringBefore("(") val link = it.selectFirst("a")!!.attr("href") @@ -48,7 +51,9 @@ class TantifilmProvider : MainAPI() { override suspend fun search(query: String): List { val queryformatted = query.replace(" ", "+") val url = "$mainUrl/search/$queryformatted" - val doc = app.get(url).document + + val interceptor = CloudflareKiller() + val doc = app.get(url, interceptor = interceptor).document return doc.select("div.film.film-2").map { val href = it.selectFirst("a")!!.attr("href") val poster = it.selectFirst("img")!!.attr("src") @@ -66,7 +71,9 @@ class TantifilmProvider : MainAPI() { } override suspend fun load(url: String): LoadResponse { - val document = app.get(url).document + + val interceptor = CloudflareKiller() + val document = app.get(url, interceptor = interceptor).document val type = if (document.selectFirst("div.category-film")!!.text().contains("Serie") .not() ) TvType.Movie else TvType.TvSeries @@ -107,7 +114,7 @@ class TantifilmProvider : MainAPI() { if (type == TvType.TvSeries) { val list = ArrayList>() val urlvideocontainer = document.selectFirst("iframe")!!.attr("src") - val videocontainer = app.get(urlvideocontainer).document + val videocontainer = app.get(urlvideocontainer, interceptor = interceptor).document videocontainer.select("nav.nav1 > select > option").forEach { element -> val season = element.text().toIntOrNull() val href = element.attr("value") @@ -120,7 +127,7 @@ class TantifilmProvider : MainAPI() { val episodeList = ArrayList() for ((season, seasonurl) in list) { - val seasonDocument = app.get(seasonurl).document + val seasonDocument = app.get(seasonurl, interceptor= interceptor).document val episodes = seasonDocument.select("nav.second_nav > select > option") if (episodes.isNotEmpty()) { episodes.forEach { episode -> @@ -221,7 +228,8 @@ class TantifilmProvider : MainAPI() { subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit ): Boolean { - val doc = app.get(data).document + val interceptor = CloudflareKiller() + val doc = app.get(data, interceptor = interceptor).document val iframe = doc.select("option").map { fixUrl(it.attr("value")) }.filter { it.contains("label") } iframe.forEach { id ->