mirror of
https://github.com/recloudstream/cloudstream-extensions-multilingual.git
synced 2024-08-15 03:15:14 +00:00
Try fix tantifilm
This commit is contained in:
parent
f7af04689b
commit
192f759647
1 changed files with 18 additions and 15 deletions
|
@ -5,7 +5,6 @@ import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
|
||||||
import com.lagradost.cloudstream3.utils.ExtractorLink
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
||||||
import com.lagradost.cloudstream3.utils.loadExtractor
|
import com.lagradost.cloudstream3.utils.loadExtractor
|
||||||
import com.lagradost.cloudstream3.network.CloudflareKiller
|
import com.lagradost.cloudstream3.network.CloudflareKiller
|
||||||
import okhttp3.Interceptor
|
|
||||||
|
|
||||||
|
|
||||||
class TantifilmProvider : MainAPI() {
|
class TantifilmProvider : MainAPI() {
|
||||||
|
@ -25,24 +24,27 @@ class TantifilmProvider : MainAPI() {
|
||||||
Pair("$mainUrl/watch-genre/film-aggiornati/page/", "Ultimi Film Aggiornati"),
|
Pair("$mainUrl/watch-genre/film-aggiornati/page/", "Ultimi Film Aggiornati"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
private val interceptor = CloudflareKiller()
|
||||||
|
|
||||||
override suspend fun getMainPage(
|
override suspend fun getMainPage(
|
||||||
page: Int,
|
page: Int,
|
||||||
request : MainPageRequest
|
request: MainPageRequest
|
||||||
): HomePageResponse {
|
): HomePageResponse {
|
||||||
val url = request.data + page
|
val url = request.data + page
|
||||||
val interceptor = CloudflareKiller()
|
|
||||||
val soup = app.get(url, interceptor = interceptor).document
|
val soup = app.get(url, interceptor = interceptor).document
|
||||||
val home = soup.select("div.media3").map {
|
val home = soup.select("div.media3").map {
|
||||||
val title = it.selectFirst("p")!!.text().substringBefore("(")
|
val title = it.selectFirst("p")!!.text().substringBefore("(")
|
||||||
val link = it.selectFirst("a")!!.attr("href")
|
val link = it.selectFirst("a")!!.attr("href")
|
||||||
|
val posterUrl = it.selectFirst("img")!!.attr("src")
|
||||||
TvSeriesSearchResponse(
|
TvSeriesSearchResponse(
|
||||||
title,
|
title,
|
||||||
link,
|
link,
|
||||||
this.name,
|
this.name,
|
||||||
TvType.Movie,
|
TvType.Movie,
|
||||||
it.selectFirst("img")!!.attr("src"),
|
posterUrl,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
|
posterHeaders = interceptor.getCookieHeaders(url).toMap()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return newHomePageResponse(request.name, home)
|
return newHomePageResponse(request.name, home)
|
||||||
|
@ -52,7 +54,6 @@ class TantifilmProvider : MainAPI() {
|
||||||
val queryformatted = query.replace(" ", "+")
|
val queryformatted = query.replace(" ", "+")
|
||||||
val url = "$mainUrl/search/$queryformatted"
|
val url = "$mainUrl/search/$queryformatted"
|
||||||
|
|
||||||
val interceptor = CloudflareKiller()
|
|
||||||
val doc = app.get(url, interceptor = interceptor).document
|
val doc = app.get(url, interceptor = interceptor).document
|
||||||
return doc.select("div.film.film-2").map {
|
return doc.select("div.film.film-2").map {
|
||||||
val href = it.selectFirst("a")!!.attr("href")
|
val href = it.selectFirst("a")!!.attr("href")
|
||||||
|
@ -64,7 +65,8 @@ class TantifilmProvider : MainAPI() {
|
||||||
this.name,
|
this.name,
|
||||||
TvType.Movie,
|
TvType.Movie,
|
||||||
poster,
|
poster,
|
||||||
null
|
null,
|
||||||
|
posterHeaders = interceptor.getCookieHeaders(url).toMap()
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -72,7 +74,6 @@ class TantifilmProvider : MainAPI() {
|
||||||
|
|
||||||
override suspend fun load(url: String): LoadResponse {
|
override suspend fun load(url: String): LoadResponse {
|
||||||
|
|
||||||
val interceptor = CloudflareKiller()
|
|
||||||
val document = app.get(url, interceptor = interceptor).document
|
val document = app.get(url, interceptor = interceptor).document
|
||||||
val type = if (document.selectFirst("div.category-film")!!.text().contains("Serie")
|
val type = if (document.selectFirst("div.category-film")!!.text().contains("Serie")
|
||||||
.not()
|
.not()
|
||||||
|
@ -104,7 +105,8 @@ class TantifilmProvider : MainAPI() {
|
||||||
this.name,
|
this.name,
|
||||||
TvType.Movie,
|
TvType.Movie,
|
||||||
poster,
|
poster,
|
||||||
null
|
null,
|
||||||
|
posterHeaders = interceptor.getCookieHeaders(url).toMap()
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -114,7 +116,7 @@ class TantifilmProvider : MainAPI() {
|
||||||
if (type == TvType.TvSeries) {
|
if (type == TvType.TvSeries) {
|
||||||
val list = ArrayList<Pair<Int, String>>()
|
val list = ArrayList<Pair<Int, String>>()
|
||||||
val urlvideocontainer = document.selectFirst("iframe")!!.attr("src")
|
val urlvideocontainer = document.selectFirst("iframe")!!.attr("src")
|
||||||
val videocontainer = app.get(urlvideocontainer, interceptor = interceptor).document
|
val videocontainer = app.get(urlvideocontainer).document
|
||||||
videocontainer.select("nav.nav1 > select > option").forEach { element ->
|
videocontainer.select("nav.nav1 > select > option").forEach { element ->
|
||||||
val season = element.text().toIntOrNull()
|
val season = element.text().toIntOrNull()
|
||||||
val href = element.attr("value")
|
val href = element.attr("value")
|
||||||
|
@ -127,7 +129,7 @@ class TantifilmProvider : MainAPI() {
|
||||||
val episodeList = ArrayList<Episode>()
|
val episodeList = ArrayList<Episode>()
|
||||||
|
|
||||||
for ((season, seasonurl) in list) {
|
for ((season, seasonurl) in list) {
|
||||||
val seasonDocument = app.get(seasonurl, interceptor= interceptor).document
|
val seasonDocument = app.get(seasonurl).document
|
||||||
val episodes = seasonDocument.select("nav.second_nav > select > option")
|
val episodes = seasonDocument.select("nav.second_nav > select > option")
|
||||||
if (episodes.isNotEmpty()) {
|
if (episodes.isNotEmpty()) {
|
||||||
episodes.forEach { episode ->
|
episodes.forEach { episode ->
|
||||||
|
@ -156,6 +158,7 @@ class TantifilmProvider : MainAPI() {
|
||||||
this.rating = rating
|
this.rating = rating
|
||||||
this.recommendations = recomm
|
this.recommendations = recomm
|
||||||
addTrailer(trailerurl)
|
addTrailer(trailerurl)
|
||||||
|
this.posterHeaders = interceptor.getCookieHeaders(url).toMap()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val url2 = document.selectFirst("iframe")!!.attr("src")
|
val url2 = document.selectFirst("iframe")!!.attr("src")
|
||||||
|
@ -168,8 +171,8 @@ class TantifilmProvider : MainAPI() {
|
||||||
|
|
||||||
val actors: List<ActorData>? = if (Linkactor.isNotEmpty()) {
|
val actors: List<ActorData>? = if (Linkactor.isNotEmpty()) {
|
||||||
val actorpage = app.get(Linkactor + "cast/").document
|
val actorpage = app.get(Linkactor + "cast/").document
|
||||||
actorpage.select("article.membro-cast").filter {
|
actorpage.select("article.membro-cast").filter { it ->
|
||||||
it -> it.selectFirst("img")
|
it.selectFirst("img")
|
||||||
?.attr("src") != "https://www.filmtv.it/imgbank/DUMMY/no_portrait.jpg"
|
?.attr("src") != "https://www.filmtv.it/imgbank/DUMMY/no_portrait.jpg"
|
||||||
}.mapNotNull {
|
}.mapNotNull {
|
||||||
val name = it.selectFirst("div.info > h3")!!.text()
|
val name = it.selectFirst("div.info > h3")!!.text()
|
||||||
|
@ -216,6 +219,7 @@ class TantifilmProvider : MainAPI() {
|
||||||
this.tags = tags
|
this.tags = tags
|
||||||
this.duration = duratio
|
this.duration = duratio
|
||||||
this.actors = actors
|
this.actors = actors
|
||||||
|
this.posterHeaders = interceptor.getCookieHeaders(url).toMap()
|
||||||
addTrailer(trailerurl)
|
addTrailer(trailerurl)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -228,10 +232,9 @@ class TantifilmProvider : MainAPI() {
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit
|
||||||
): Boolean {
|
): Boolean {
|
||||||
val interceptor = CloudflareKiller()
|
val doc = app.get(data).document
|
||||||
val doc = app.get(data, interceptor = interceptor).document
|
|
||||||
val iframe =
|
val iframe =
|
||||||
doc.select("option").map { fixUrl(it.attr("value")) }.filter { it.contains("label") }
|
doc.select("option").map { it.attr("value") }.filter { it.contains("label") }
|
||||||
iframe.forEach { id ->
|
iframe.forEach { id ->
|
||||||
val doc2 = app.get(id).document
|
val doc2 = app.get(id).document
|
||||||
val id2 = app.get(doc2.selectFirst("iframe")!!.attr("src")).url
|
val id2 = app.get(doc2.selectFirst("iframe")!!.attr("src")).url
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue