2022-08-17 12:09:52 +00:00
|
|
|
package com.lagradost
|
|
|
|
|
|
|
|
//import androidx.core.text.parseAsHtml
|
|
|
|
import com.lagradost.cloudstream3.*
|
|
|
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addRating
|
|
|
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
|
|
|
|
import com.lagradost.cloudstream3.utils.AppUtils.toJson
|
|
|
|
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
|
|
|
|
import com.lagradost.cloudstream3.utils.ExtractorLink
|
|
|
|
import com.lagradost.cloudstream3.utils.ShortLink
|
|
|
|
import com.lagradost.cloudstream3.utils.loadExtractor
|
|
|
|
import org.jsoup.nodes.Element
|
|
|
|
import com.lagradost.cloudstream3.utils.AppUtils.html
|
2022-10-15 20:54:43 +00:00
|
|
|
import com.lagradost.cloudstream3.network.CloudflareKiller
|
2022-08-17 12:09:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
class FilmpertuttiProvider : MainAPI() {
|
|
|
|
override var lang = "it"
|
2022-12-06 23:35:00 +00:00
|
|
|
override var mainUrl = "https://filmpertutti.skin"
|
2022-10-09 00:39:16 +00:00
|
|
|
override var name = "FilmPerTutti"
|
2022-08-17 12:09:52 +00:00
|
|
|
override val hasMainPage = true
|
|
|
|
override val hasChromecastSupport = true
|
|
|
|
override val supportedTypes = setOf(
|
|
|
|
TvType.Movie,
|
|
|
|
TvType.TvSeries
|
|
|
|
)
|
2022-10-09 00:39:16 +00:00
|
|
|
override var sequentialMainPage = true
|
2022-12-06 23:35:00 +00:00
|
|
|
override var sequentialMainPageDelay: Long = 50
|
2022-08-17 12:09:52 +00:00
|
|
|
override val mainPage = mainPageOf(
|
|
|
|
Pair("$mainUrl/category/film/page/", "Film Popolari"),
|
|
|
|
Pair("$mainUrl/category/serie-tv/page/", "Serie Tv Popolari"),
|
2022-10-09 00:39:16 +00:00
|
|
|
Pair("$mainUrl/prime-visioni/", "Ultime uscite")
|
2022-08-17 12:09:52 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
override suspend fun getMainPage(
|
|
|
|
page: Int,
|
|
|
|
request: MainPageRequest
|
|
|
|
): HomePageResponse {
|
|
|
|
val url = request.data + page
|
2022-12-06 23:35:00 +00:00
|
|
|
val soup = app.get(url).document
|
2022-08-17 12:09:52 +00:00
|
|
|
val home = soup.select("ul.posts > li").map {
|
|
|
|
val title = it.selectFirst("div.title")!!.text().substringBeforeLast("(")
|
|
|
|
.substringBeforeLast("[")
|
|
|
|
val link = it.selectFirst("a")!!.attr("href")
|
|
|
|
val image = it.selectFirst("a")!!.attr("data-thumbnail")
|
|
|
|
val qualitydata = it.selectFirst("div.hd")
|
|
|
|
val quality = if (qualitydata != null) {
|
|
|
|
getQualityFromString(qualitydata.text())
|
|
|
|
} else {
|
|
|
|
null
|
|
|
|
}
|
|
|
|
newTvSeriesSearchResponse(
|
|
|
|
title,
|
|
|
|
link
|
|
|
|
) {
|
|
|
|
this.posterUrl = image
|
|
|
|
this.quality = quality
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return newHomePageResponse(request.name, home)
|
|
|
|
}
|
|
|
|
|
|
|
|
override suspend fun search(query: String): List<SearchResponse> {
|
|
|
|
val queryformatted = query.replace(" ", "+")
|
|
|
|
val url = "$mainUrl/?s=$queryformatted"
|
2022-12-06 23:35:00 +00:00
|
|
|
val doc = app.get(url).document
|
2022-08-17 12:09:52 +00:00
|
|
|
return doc.select("ul.posts > li").map {
|
|
|
|
val title = it.selectFirst("div.title")!!.text().substringBeforeLast("(")
|
|
|
|
.substringBeforeLast("[")
|
|
|
|
val link = it.selectFirst("a")!!.attr("href")
|
|
|
|
val image = it.selectFirst("a")!!.attr("data-thumbnail")
|
|
|
|
val quality = getQualityFromString(it.selectFirst("div.hd")?.text())
|
|
|
|
|
|
|
|
MovieSearchResponse(
|
|
|
|
title,
|
|
|
|
link,
|
|
|
|
this.name,
|
|
|
|
quality = quality,
|
|
|
|
posterUrl = image
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
override suspend fun load(url: String): LoadResponse {
|
2022-12-06 23:35:00 +00:00
|
|
|
val document = app.get(url).document
|
2022-08-17 12:09:52 +00:00
|
|
|
val type =
|
|
|
|
if (document.selectFirst("a.taxonomy.category")!!.attr("href").contains("serie-tv")
|
|
|
|
.not()
|
|
|
|
) TvType.Movie else TvType.TvSeries
|
|
|
|
val title = document.selectFirst("#content > h1")!!.text().substringBeforeLast("(")
|
|
|
|
.substringBeforeLast("[")
|
|
|
|
|
2022-12-06 23:35:00 +00:00
|
|
|
val descriptionindex = document.select("div.meta > div > div").indexOfFirst { it.getElementsContainingText("Trama").isNotEmpty() }
|
|
|
|
val description = document.select("div.meta > div > div")[descriptionindex +1].text()
|
2022-08-17 12:09:52 +00:00
|
|
|
|
|
|
|
val rating = document.selectFirst("div.rating > div.value")?.text()
|
|
|
|
|
|
|
|
val year =
|
|
|
|
document.selectFirst("#content > h1")?.text()?.substringAfterLast("(")
|
|
|
|
?.filter { it.isDigit() }?.toIntOrNull()
|
|
|
|
?: description.substringAfter("trasmessa nel").take(6).filter { it.isDigit() }
|
|
|
|
.toIntOrNull() ?: (document.selectFirst("i.fa.fa-calendar.fa-fw")?.parent()
|
|
|
|
?.nextSibling() as Element?)?.text()?.substringAfterLast(" ")
|
|
|
|
?.filter { it.isDigit() }?.toIntOrNull()
|
|
|
|
|
2022-12-06 23:35:00 +00:00
|
|
|
val horizontalPosterData = document.selectFirst("body > main")?.attr("style")?:""
|
|
|
|
val poster =
|
|
|
|
Regex("url\\('(.*)'").find(horizontalPosterData)?.groups?.lastOrNull()?.value?:
|
|
|
|
document.selectFirst("div.meta > div > img")?.attr("src")
|
2022-08-17 12:09:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
val trailerurl =
|
|
|
|
document.selectFirst("div.youtube-player")?.attr("data-id")?.let { urldata ->
|
|
|
|
"https://www.youtube.com/watch?v=$urldata"
|
|
|
|
}
|
|
|
|
|
|
|
|
if (type == TvType.TvSeries) {
|
|
|
|
|
|
|
|
val episodeList = ArrayList<Episode>()
|
|
|
|
document.select("div.accordion-item").filter { a ->
|
|
|
|
a.selectFirst("#season > ul > li.s_title > span")!!.text().isNotEmpty()
|
|
|
|
}.map { element ->
|
|
|
|
val season =
|
|
|
|
element.selectFirst("#season > ul > li.s_title > span")!!.text().toInt()
|
|
|
|
element.select("div.episode-wrap").map { episode ->
|
|
|
|
val href =
|
|
|
|
episode.select("#links > div > div > table > tbody:nth-child(2) > tr")
|
|
|
|
.map { it.selectFirst("a")!!.attr("href") }.toJson()
|
|
|
|
val epNum = episode.selectFirst("li.season-no")!!.text().substringAfter("x")
|
|
|
|
.filter { it.isDigit() }.toIntOrNull()
|
|
|
|
val epTitle = episode.selectFirst("li.other_link > a")?.text()
|
|
|
|
|
|
|
|
val posterUrl = episode.selectFirst("figure > img")?.attr("data-src")
|
|
|
|
episodeList.add(
|
|
|
|
Episode(
|
|
|
|
href,
|
|
|
|
epTitle,
|
|
|
|
season,
|
|
|
|
epNum,
|
|
|
|
posterUrl,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return newTvSeriesLoadResponse(
|
|
|
|
title,
|
|
|
|
url, type, episodeList
|
|
|
|
) {
|
|
|
|
this.posterUrl = poster
|
|
|
|
this.year = year
|
|
|
|
this.plot = description
|
|
|
|
addRating(rating)
|
|
|
|
addTrailer(trailerurl)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
|
|
|
|
val urls0 = document.select("div.embed-player")
|
|
|
|
val urls = if (urls0.isNotEmpty()) {
|
|
|
|
urls0.map { it.attr("data-id") }.toJson()
|
|
|
|
} else {
|
|
|
|
document.select("#info > ul > li ").mapNotNull { it.selectFirst("a")?.attr("href") }
|
|
|
|
.toJson()
|
|
|
|
}
|
|
|
|
|
|
|
|
return newMovieLoadResponse(
|
|
|
|
title,
|
|
|
|
url,
|
|
|
|
type,
|
|
|
|
urls
|
|
|
|
) {
|
|
|
|
posterUrl = fixUrlNull(poster)
|
|
|
|
this.year = year
|
|
|
|
this.plot = description
|
|
|
|
addRating(rating)
|
|
|
|
addTrailer(trailerurl)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
override suspend fun loadLinks(
|
|
|
|
data: String,
|
|
|
|
isCasting: Boolean,
|
|
|
|
subtitleCallback: (SubtitleFile) -> Unit,
|
|
|
|
callback: (ExtractorLink) -> Unit
|
|
|
|
): Boolean {
|
|
|
|
tryParseJson<List<String>>(data)?.apmap { id ->
|
|
|
|
val link = ShortLink.unshorten(id).trim().replace("/v/", "/e/").replace("/f/", "/e/")
|
|
|
|
loadExtractor(link, data, subtitleCallback, callback)
|
|
|
|
}
|
|
|
|
return true
|
|
|
|
}
|
2022-12-06 23:35:00 +00:00
|
|
|
}
|