Tantifilm (cloudflare) and IlGenioDelloStreamingProvider fixes (#4)

This commit is contained in:
antonydp 2022-08-27 16:27:45 +02:00 committed by GitHub
parent dd31f0eead
commit 7dbb146399
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 208 additions and 28 deletions

View file

@ -0,0 +1,26 @@
// use an integer for version numbers
version = 1
cloudstream {
language = "it"
// All of these properties are optional, you can safely remove them
// description = "Lorem Ipsum"
// authors = listOf("Cloudburst")
/**
* Status int as the following:
* 0: Down
* 1: Ok
* 2: Slow
* 3: Beta only
* */
status = 1 // will be 3 if unspecified
tvTypes = listOf(
"TvSeries"
)
iconUrl = "https://www.google.com/s2/favicons?domain=eurostreaming.social&sz=%size%"
}

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.lagradost"/>

View file

@ -0,0 +1,113 @@
package com.lagradost
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.loadExtractor
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
import com.lagradost.cloudstream3.utils.AppUtils.toJson
class EurostreamingProvider : MainAPI() {
override var lang = "it"
override var mainUrl = "https://eurostreaming.social"
override var name = "Eurostreaming"
override val hasMainPage = true
override val hasChromecastSupport = true
override val supportedTypes = setOf(
TvType.TvSeries
)
override val mainPage = mainPageOf(
Pair("$mainUrl/serie-tv-archive/page/", "Ultime serie Tv"),
Pair("$mainUrl/animazione/page/", "Ultime serie Animazione"),
)
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
val url = request.data + page
val soup = app.get(url).document
val home = soup.select("div.post-thumb").map {
val title = it.selectFirst("img")!!.attr("alt")
val link = it.selectFirst("a")!!.attr("href")
val image = fixUrl(it.selectFirst("img")!!.attr("src"))
MovieSearchResponse(
title,
link,
this.name,
TvType.Movie,
image
)
}
return newHomePageResponse(request.name, home)
}
override suspend fun search(query: String): List<SearchResponse> {
val doc = app.post(
"$mainUrl/index.php", data = mapOf(
"do" to "search",
"subaction" to "search",
"story" to query,
"sortby" to "news_read"
)
).document
return doc.select("div.post-thumb").map {
val title = it.selectFirst("img")!!.attr("alt")
val link = it.selectFirst("a")!!.attr("href")
val image = mainUrl + it.selectFirst("img")!!.attr("src")
MovieSearchResponse(
title,
link,
this.name,
TvType.Movie,
image
)
}
}
override suspend fun load(url: String): LoadResponse {
val page = app.get(url)
val document = page.document
val title = document.selectFirst("h2")!!.text().replace("^([1-9+]]$","")
val style = document.selectFirst("div.entry-cover")!!.attr("style")
val poster = fixUrl(Regex("(/upload.+\\))").find(style)!!.value.dropLast(1))
val episodeList = ArrayList<Episode>()
document.select("div.tab-pane.fade").map { element ->
val season = element.attr("id").filter { it.isDigit() }.toInt()
element.select("li").filter { it-> it.selectFirst("a")?.hasAttr("data-title")?:false }.map{episode ->
val data = episode.select("div.mirrors > a").map { it.attr("data-link") }.toJson()
val epnameData = episode.selectFirst("a")
val epTitle = epnameData!!.attr("data-title")
val epNum = epnameData.text().toInt()
episodeList.add(
Episode(
data,
epTitle,
season,
epNum
)
)
}
}
return newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodeList) {
posterUrl = poster
}
}
override suspend fun loadLinks(
data: String,
isCasting: Boolean,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
): Boolean {
parseJson<List<String>>(data).map { videoUrl ->
loadExtractor(videoUrl, data, subtitleCallback, callback)
}
return true
}
}

View file

@ -0,0 +1,14 @@
package com.lagradost
import com.lagradost.cloudstream3.plugins.CloudstreamPlugin
import com.lagradost.cloudstream3.plugins.Plugin
import android.content.Context
@CloudstreamPlugin
class EurostreamingProviderPlugin: Plugin() {
override fun load(context: Context) {
// All providers should be added in this manner. Please don't edit the providers list directly.
registerMainAPI(EurostreamingProvider())
}
}

View file

@ -9,6 +9,7 @@ import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.ShortLink import com.lagradost.cloudstream3.utils.ShortLink
import com.lagradost.cloudstream3.utils.loadExtractor import com.lagradost.cloudstream3.utils.loadExtractor
import org.jsoup.Jsoup import org.jsoup.Jsoup
import org.jsoup.nodes.Element
class IlGenioDelloStreamingProvider : MainAPI() { class IlGenioDelloStreamingProvider : MainAPI() {
@ -74,7 +75,7 @@ class IlGenioDelloStreamingProvider : MainAPI() {
override suspend fun load(url: String): LoadResponse { override suspend fun load(url: String): LoadResponse {
val page = app.get(url) val page = app.get(url)
val document = page.document val document = page.document
val type = if (document.selectFirst("div.sgeneros")?.text() == "Serie TV"){TvType.TvSeries} else{TvType.Movie} val type = if (document.select("div.seasons-wraper").isNotEmpty()){TvType.TvSeries} else{TvType.Movie}
val title = document.selectFirst("div.data > h1")!!.text().substringBefore("(").substringBefore("[") val title = document.selectFirst("div.data > h1")!!.text().substringBefore("(").substringBefore("[")
val description = document.selectFirst("div#info")?.selectFirst("p")?.html() val description = document.selectFirst("div#info")?.selectFirst("p")?.html()
val rating = document.select("span.valor").last()?.text()?.split(" ")?.get(0) val rating = document.select("span.valor").last()?.text()?.split(" ")?.get(0)
@ -104,23 +105,36 @@ class IlGenioDelloStreamingProvider : MainAPI() {
if (type == TvType.TvSeries) { if (type == TvType.TvSeries) {
val episodeList = ArrayList<Episode>() val episodeList = ArrayList<Episode>()
val seasons = document.selectFirst("div#info")?.select("p")?.map {it.children() } document.selectFirst("div.seasons-wraper")
?.filter { it.size > 1 && it.first()!!.hasAttr("href") } ?.select("div.accordion-item ")?.groupBy {it.selectFirst("span.season-title")!!.text() }?.map { seasons ->
?.map{(it.toString().split("<br>")) seasons.value.map {season -> season.select("div.episode-wrap")}.flatten()
.map{Jsoup.parse(it).select("a") .groupBy { it.selectFirst("li.season-no")?.text()?.substringBeforeLast(" ") }
?.map { it?.attr("href") }}} .map { episodeItaSub ->
seasons?.mapIndexed { season, element -> val episodes = episodeItaSub.value
element.mapIndexed { index, list -> val posterUrl = episodes.firstNotNullOf { it.selectFirst("img")?.attr("src")}
val urls = list?.toJson()?:url val epName = episodes.firstNotNullOf{it.selectFirst("li.other_link")?.text()?:""}
episodeList.add(
Episode( episodes.map{ episode ->
val seasonNo = episode.selectFirst("li.season-no")
val subtag = seasonNo?.text()?.takeIf {it.contains("Sub")}?.substringAfter(" ") ?: ""
val urls = episode.getElementsByAttributeValue("target", "_blank").map { it.attr("href").trim() }
.filter { it.isNotEmpty()}.toJson()
episodeList.add(Episode(
data = urls, data = urls,
episode = index + 1, posterUrl = posterUrl,
season = season + 1 season = seasons.key.toIntOrNull(),
) name = "$epName ${subtag.uppercase()}",
) episode = seasonNo?.text()?.substringAfter("x")?.filter { it.isDigit() }?.toIntOrNull()
))
}
} }
} }
val seasonnames = document.selectFirst("div#info")?.select("p")?.map {it.children() } val seasonnames = document.selectFirst("div#info")?.select("p")?.map {it.children() }
?.filter { it.size<3 && it.isNotEmpty()}?.map{it.text()} ?.filter { it.size<3 && it.isNotEmpty()}?.map{it.text()}

View file

@ -16,7 +16,7 @@ cloudstream {
* 2: Slow * 2: Slow
* 3: Beta only * 3: Beta only
* */ * */
status = 0 // will be 3 if unspecified status = 1 // will be 3 if unspecified
tvTypes = listOf( tvTypes = listOf(
"TvSeries", "TvSeries",
"Movie", "Movie",

View file

@ -4,6 +4,7 @@ import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer 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
class TantifilmProvider : MainAPI() { class TantifilmProvider : MainAPI() {
@ -23,23 +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 soup = app.get(url).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)
@ -48,7 +53,8 @@ class TantifilmProvider : MainAPI() {
override suspend fun search(query: String): List<SearchResponse> { override suspend fun search(query: String): List<SearchResponse> {
val queryformatted = query.replace(" ", "+") val queryformatted = query.replace(" ", "+")
val url = "$mainUrl/search/$queryformatted" val url = "$mainUrl/search/$queryformatted"
val doc = app.get(url).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")
val poster = it.selectFirst("img")!!.attr("src") val poster = it.selectFirst("img")!!.attr("src")
@ -59,14 +65,16 @@ class TantifilmProvider : MainAPI() {
this.name, this.name,
TvType.Movie, TvType.Movie,
poster, poster,
null null,
posterHeaders = interceptor.getCookieHeaders(url).toMap()
) )
} }
} }
override suspend fun load(url: String): LoadResponse { override suspend fun load(url: String): LoadResponse {
val document = app.get(url).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()
) TvType.Movie else TvType.TvSeries ) TvType.Movie else TvType.TvSeries
@ -97,7 +105,8 @@ class TantifilmProvider : MainAPI() {
this.name, this.name,
TvType.Movie, TvType.Movie,
poster, poster,
null null,
posterHeaders = interceptor.getCookieHeaders(url).toMap()
) )
} }
@ -149,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")
@ -161,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()
@ -209,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)
} }
@ -223,7 +234,7 @@ class TantifilmProvider : MainAPI() {
): Boolean { ): Boolean {
val doc = app.get(data).document val doc = app.get(data).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