mirror of
https://github.com/recloudstream/cloudstream-extensions-multilingual.git
synced 2024-08-15 03:15:14 +00:00
Fixes and removed interceptor in main page
This commit is contained in:
parent
453fbd6ea0
commit
44885f5256
1 changed files with 110 additions and 101 deletions
|
@ -1,5 +1,6 @@
|
||||||
package com.lagradost
|
package com.lagradost
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
import com.lagradost.cloudstream3.*
|
import com.lagradost.cloudstream3.*
|
||||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addRating
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addRating
|
||||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
|
||||||
|
@ -17,26 +18,26 @@ import org.jsoup.nodes.Element
|
||||||
class IlGenioDelloStreamingProvider : MainAPI() {
|
class IlGenioDelloStreamingProvider : MainAPI() {
|
||||||
override var lang = "it"
|
override var lang = "it"
|
||||||
override var mainUrl = "https://ilgeniodellostreaming.hair"
|
override var mainUrl = "https://ilgeniodellostreaming.hair"
|
||||||
override var name = "IlGenioDelloStreaming"
|
override var name = "IlGenioDelloStreaming-t"
|
||||||
override val hasMainPage = true
|
override val hasMainPage = true
|
||||||
override val hasChromecastSupport = true
|
override val hasChromecastSupport = true
|
||||||
override var sequentialMainPage = true
|
override var sequentialMainPage = true
|
||||||
override val supportedTypes =
|
override val supportedTypes =
|
||||||
setOf(
|
setOf(
|
||||||
TvType.Movie,
|
TvType.Movie,
|
||||||
TvType.TvSeries,
|
TvType.TvSeries,
|
||||||
)
|
)
|
||||||
override val mainPage =
|
override val mainPage =
|
||||||
mainPageOf(
|
mainPageOf(
|
||||||
Pair("$mainUrl/popular-movies/page/", "Film Popolari"),
|
Pair("$mainUrl/popular-movies/page/", "Film Popolari"),
|
||||||
Pair("$mainUrl/the-most-voted/page/", "I più votati"),
|
Pair("$mainUrl/the-most-voted/page/", "I più votati"),
|
||||||
)
|
)
|
||||||
private val interceptor = CloudflareKiller()
|
private val interceptor = CloudflareKiller()
|
||||||
|
|
||||||
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
|
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
|
||||||
val url = request.data + page
|
val url = request.data + page
|
||||||
|
|
||||||
val soup = app.get(url, interceptor = interceptor, referer = mainUrl).document
|
val soup = app.get(url, referer = mainUrl).document
|
||||||
val home = soup.select("div.items > article.item").mapNotNull { it.toMainPageResult() }
|
val home = soup.select("div.items > article.item").mapNotNull { it.toMainPageResult() }
|
||||||
val hasNext = home.isNotEmpty()
|
val hasNext = home.isNotEmpty()
|
||||||
return newHomePageResponse(arrayListOf(HomePageList(request.name, home)), hasNext = hasNext)
|
return newHomePageResponse(arrayListOf(HomePageList(request.name, home)), hasNext = hasNext)
|
||||||
|
@ -44,33 +45,30 @@ class IlGenioDelloStreamingProvider : MainAPI() {
|
||||||
|
|
||||||
private fun Element.toMainPageResult(): SearchResponse {
|
private fun Element.toMainPageResult(): SearchResponse {
|
||||||
val title =
|
val title =
|
||||||
this.selectFirst("div.data>h3")
|
this.selectFirst("div.data>h3")
|
||||||
?.text()
|
?.text()
|
||||||
?.replace("[HD]", "")
|
?.trim()
|
||||||
?.replace("\\(\\d{4}\\)".toRegex(), "")
|
?.replace("[HD]", "")
|
||||||
?: "No title"
|
?.replace("\\(\\d{4}\\)".toRegex(), "")
|
||||||
|
?: "No title"
|
||||||
val isMovie =
|
val isMovie =
|
||||||
(this.selectFirst("div.data>h3")?.text() ?: "").contains("\\(\\d{4}\\)".toRegex())
|
(this.selectFirst("div.data>h3")?.text() ?: "").contains("\\(\\d{4}\\)".toRegex())
|
||||||
val link =
|
val link =
|
||||||
this.selectFirst("div.poster>a")?.attr("href")
|
this.selectFirst("div.poster>a")?.attr("href")
|
||||||
?: throw ErrorLoadingException("No Link found")
|
?: throw ErrorLoadingException("No Link found")
|
||||||
|
|
||||||
val quality = this.selectFirst("div.poster>span.quality")?.text()
|
val quality = this.selectFirst("div.poster>span.quality")?.text()
|
||||||
val posterUrl = this.selectFirst("div.poster>a>img")?.attr("src")
|
val posterUrl = this.selectFirst("div.poster>a>img")?.attr("src")
|
||||||
|
|
||||||
if (isMovie) {
|
return if (isMovie) {
|
||||||
return newMovieSearchResponse(title, link, TvType.Movie) {
|
newMovieSearchResponse(title, link, TvType.Movie) {
|
||||||
addPoster(posterUrl)
|
addPoster(posterUrl)
|
||||||
if (quality != null) {
|
quality?.let { addQuality(it) }
|
||||||
addQuality(quality)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return newTvSeriesSearchResponse(title, link, TvType.TvSeries) {
|
newTvSeriesSearchResponse(title, link, TvType.TvSeries) {
|
||||||
addPoster(posterUrl)
|
addPoster(posterUrl)
|
||||||
if (quality != null) {
|
quality?.let { addQuality(it) }
|
||||||
addQuality(quality)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,30 +82,31 @@ class IlGenioDelloStreamingProvider : MainAPI() {
|
||||||
|
|
||||||
private fun Element.toSearchResult(): SearchResponse {
|
private fun Element.toSearchResult(): SearchResponse {
|
||||||
val title =
|
val title =
|
||||||
this.selectFirst("div.title>a")
|
this.selectFirst("div.title>a")
|
||||||
?.text()
|
?.text()
|
||||||
?.replace("[HD]", "")
|
?.trim()
|
||||||
?.replace("\\(\\d{4}\\)".toRegex(), "")
|
?.replace("[HD]", "")
|
||||||
?: "No title"
|
?.replace("\\(\\d{4}\\)".toRegex(), "")
|
||||||
|
?: "No title"
|
||||||
val isMovie =
|
val isMovie =
|
||||||
(this.selectFirst("div.title>a")?.text() ?: "").contains("\\(\\d{4}\\)".toRegex())
|
(this.selectFirst("div.title>a")?.text() ?: "").contains("\\(\\d{4}\\)".toRegex())
|
||||||
val link =
|
val link =
|
||||||
this.selectFirst("div.title>a")?.attr("href")
|
this.selectFirst("div.title>a")?.attr("href")
|
||||||
?: throw ErrorLoadingException("No Link found")
|
?: throw ErrorLoadingException("No Link found")
|
||||||
|
|
||||||
val quality =
|
val quality =
|
||||||
this.selectFirst("div.title>a")?.text()?.substringAfter("[")?.substringBefore("]")
|
this.selectFirst("div.title>a")?.text()?.substringAfter("[")?.substringBefore("]")
|
||||||
val posterUrl = this.selectFirst("a>img")?.attr("src")
|
val posterUrl = this.selectFirst("a>img")?.attr("src")
|
||||||
|
|
||||||
if (isMovie) {
|
return if (isMovie) {
|
||||||
return newMovieSearchResponse(title, link, TvType.Movie) {
|
newMovieSearchResponse(title, link, TvType.Movie) {
|
||||||
addPoster(posterUrl)
|
addPoster(posterUrl)
|
||||||
if (quality != null) {
|
if (quality != null) {
|
||||||
addQuality(quality)
|
addQuality(quality)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return newTvSeriesSearchResponse(title, link, TvType.TvSeries) {
|
newTvSeriesSearchResponse(title, link, TvType.TvSeries) {
|
||||||
addPoster(posterUrl)
|
addPoster(posterUrl)
|
||||||
if (quality != null) {
|
if (quality != null) {
|
||||||
addQuality(quality)
|
addQuality(quality)
|
||||||
|
@ -117,52 +116,53 @@ class IlGenioDelloStreamingProvider : MainAPI() {
|
||||||
}
|
}
|
||||||
|
|
||||||
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, referer = mainUrl).document
|
||||||
val type =
|
val type =
|
||||||
if (document.select("div.seasons-wraper").isNotEmpty()) TvType.TvSeries
|
if (document.select("div.seasons-wraper").isNotEmpty()) TvType.TvSeries
|
||||||
else TvType.Movie
|
else TvType.Movie
|
||||||
|
|
||||||
val title =
|
val title =
|
||||||
document.selectFirst("div.data > h1")
|
document.selectFirst("div.data > h1")
|
||||||
?.text()
|
?.text()
|
||||||
?.substringBefore("Streaming")
|
?.trim()
|
||||||
?.replace("[HD]", "")
|
?.substringBefore("Streaming")
|
||||||
?.replace("\\(\\d{4}\\)".toRegex(), "")
|
?.replace("[HD]", "")
|
||||||
?: "No Title found"
|
?.replace("\\(\\d{4}\\)".toRegex(), "")
|
||||||
|
?: "No Title found"
|
||||||
val description =
|
val description =
|
||||||
document.selectFirst("div#info")
|
document.selectFirst("div#info")
|
||||||
?.text()
|
?.text()
|
||||||
?.substringAfter(".")
|
?.substringAfter(".")
|
||||||
?.substringBefore("Leggi anche")
|
?.substringBefore("Leggi anche")
|
||||||
val year =
|
val year =
|
||||||
document.selectFirst("b.variante>strong>a")
|
document.selectFirst("b.variante>strong>a")
|
||||||
?.text()
|
?.text()
|
||||||
?.substringBefore("-")
|
?.substringBefore("-")
|
||||||
?.substringAfter(",")
|
?.substringAfter(",")
|
||||||
?.filter { it.isDigit() }
|
?.filter { it.isDigit() }
|
||||||
val poster = document.selectFirst("div.poster>img")?.attr("src")
|
val poster = document.selectFirst("div.poster>img")?.attr("src")
|
||||||
val rating = document.selectFirst("span.valor>strong")?.text()?.toRatingInt()
|
val rating = document.selectFirst("span.valor>strong")?.text()?.toRatingInt()
|
||||||
val trailer =
|
val trailer =
|
||||||
"https://www.youtube.com/watch?v=" +
|
"https://www.youtube.com/watch?v=" +
|
||||||
document.selectFirst("img.youtube__img")
|
document.selectFirst("img.youtube__img")
|
||||||
?.attr("src")
|
?.attr("src")
|
||||||
?.substringAfter("vi/")
|
?.substringAfter("vi/")
|
||||||
?.substringBefore("/")
|
?.substringBefore("/")
|
||||||
val recomm = document.select("article.w_item_b").map { it.toRecommendResult() }
|
val recomm = document.select("article.w_item_b").map { it.toRecommendResult() }
|
||||||
if (type == TvType.TvSeries) {
|
if (type == TvType.TvSeries) {
|
||||||
val episodeList =
|
val episodeList =
|
||||||
document.select("div.accordion>div.accordion-item")
|
document.select("div.accordion>div.accordion-item")
|
||||||
.map { element ->
|
.map { element ->
|
||||||
val season =
|
val season =
|
||||||
element.selectFirst("li.s_title>span.season-title")
|
element.selectFirst("li.s_title>span.season-title")
|
||||||
?.text()
|
?.text()
|
||||||
?.toIntOrNull()
|
?.toIntOrNull()
|
||||||
?: 0
|
?: 0
|
||||||
element.select("div.episode-wrap").map { episode ->
|
element.select("div.episode-wrap").map { episode ->
|
||||||
episode.toEpisode(season)
|
episode.toEpisode(season)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.flatten()
|
.flatten()
|
||||||
|
|
||||||
return newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodeList) {
|
return newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodeList) {
|
||||||
this.year = year?.toIntOrNull()
|
this.year = year?.toIntOrNull()
|
||||||
|
@ -174,12 +174,12 @@ class IlGenioDelloStreamingProvider : MainAPI() {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val actors: List<ActorData> =
|
val actors: List<ActorData> =
|
||||||
document.select("div.cast_wraper>ul>li").map { actordata ->
|
document.select("div.cast_wraper>ul>li").map { actordata ->
|
||||||
val actorName = actordata.selectFirst("strong")?.text() ?: ""
|
val actorName = actordata.selectFirst("strong")?.text() ?: ""
|
||||||
val actorImage: String? =
|
val actorImage: String? =
|
||||||
actordata.selectFirst("figure>img")?.attr("src") ?: ""
|
actordata.selectFirst("figure>img")?.attr("src") ?: ""
|
||||||
ActorData(actor = Actor(actorName, image = actorImage))
|
ActorData(actor = Actor(actorName, image = actorImage))
|
||||||
}
|
}
|
||||||
val data = document.select(".embed-player").map { it.attr("data-id") }.toJson()
|
val data = document.select(".embed-player").map { it.attr("data-id") }.toJson()
|
||||||
return newMovieLoadResponse(title, data, TvType.Movie, data) {
|
return newMovieLoadResponse(title, data, TvType.Movie, data) {
|
||||||
this.year = year?.toIntOrNull()
|
this.year = year?.toIntOrNull()
|
||||||
|
@ -195,29 +195,30 @@ class IlGenioDelloStreamingProvider : MainAPI() {
|
||||||
|
|
||||||
private fun Element.toRecommendResult(): SearchResponse {
|
private fun Element.toRecommendResult(): SearchResponse {
|
||||||
val title =
|
val title =
|
||||||
this.selectFirst("div.data>h3")
|
this.selectFirst("div.data>h3")
|
||||||
?.text()
|
?.text()
|
||||||
?.replace("[HD]", "")
|
?.trim()
|
||||||
?.replace("\\(\\d{4}\\)".toRegex(), "")
|
?.replace("[HD]", "")
|
||||||
?: "No title"
|
?.replace("\\(\\d{4}\\)".toRegex(), "")
|
||||||
|
?: "No title"
|
||||||
val isMovie =
|
val isMovie =
|
||||||
(this.selectFirst("div.data>h3")?.text() ?: "").contains("\\(\\d{4}\\)".toRegex())
|
(this.selectFirst("div.data>h3")?.text() ?: "").contains("\\(\\d{4}\\)".toRegex())
|
||||||
val link =
|
val link =
|
||||||
this.selectFirst("a")?.attr("href") ?: throw ErrorLoadingException("No Link found")
|
this.selectFirst("a")?.attr("href") ?: throw ErrorLoadingException("No Link found")
|
||||||
|
|
||||||
val quality =
|
val quality =
|
||||||
this.selectFirst("div.data>h3")?.text()?.substringAfter("[")?.substringBefore("]")
|
this.selectFirst("div.data>h3")?.text()?.substringAfter("[")?.substringBefore("]")
|
||||||
val posterUrl = this.selectFirst("div.image>img")?.attr("src")
|
val posterUrl = this.selectFirst("div.image>img")?.attr("src")
|
||||||
|
|
||||||
if (isMovie) {
|
return if (isMovie) {
|
||||||
return newMovieSearchResponse(title, link, TvType.Movie) {
|
newMovieSearchResponse(title, link, TvType.Movie) {
|
||||||
addPoster(posterUrl)
|
addPoster(posterUrl)
|
||||||
if (quality != null) {
|
if (quality != null) {
|
||||||
addQuality(quality)
|
addQuality(quality)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return newTvSeriesSearchResponse(title, link, TvType.TvSeries) {
|
newTvSeriesSearchResponse(title, link, TvType.TvSeries) {
|
||||||
addPoster(posterUrl)
|
addPoster(posterUrl)
|
||||||
if (quality != null) {
|
if (quality != null) {
|
||||||
addQuality(quality)
|
addQuality(quality)
|
||||||
|
@ -228,20 +229,28 @@ class IlGenioDelloStreamingProvider : MainAPI() {
|
||||||
|
|
||||||
private fun Element.toEpisode(season: Int): Episode {
|
private fun Element.toEpisode(season: Int): Episode {
|
||||||
val data =
|
val data =
|
||||||
this.select("div.fix-table>table>tbody>tr>td>a[target=_blank]") // buckler.link
|
this.select("div.fix-table>table>tbody>tr>td>a[target=_blank]") // buckler.link
|
||||||
.map { it.attr("href") }
|
.map { it.attr("href") }
|
||||||
.toJson()
|
.toJson()
|
||||||
val epTitle = this.selectFirst("li.other_link>a")?.text() ?: "No Ep. Title 0"
|
val epNum =
|
||||||
val epNum = epTitle.substringAfter("Episodio ").toInt()
|
this.selectFirst("li.season-no")
|
||||||
|
?.text()
|
||||||
|
?.substringAfter("x")
|
||||||
|
?.substringBefore(" ")
|
||||||
|
|
||||||
|
val epTitle =
|
||||||
|
this.selectFirst("li.other_link>a")?.text().orEmpty().ifBlank {
|
||||||
|
"Episodio $epNum"
|
||||||
|
}
|
||||||
val posterUrl = this.selectFirst("img")?.attr("src")
|
val posterUrl = this.selectFirst("img")?.attr("src")
|
||||||
return Episode(data, epTitle, season, epNum, posterUrl = posterUrl)
|
return Episode(data, epTitle, season, epNum?.toInt(), posterUrl = posterUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun loadLinks(
|
override suspend fun loadLinks(
|
||||||
data: String,
|
data: String,
|
||||||
isCasting: Boolean,
|
isCasting: Boolean,
|
||||||
subtitleCallback: (SubtitleFile) -> Unit,
|
subtitleCallback: (SubtitleFile) -> Unit,
|
||||||
callback: (ExtractorLink) -> Unit
|
callback: (ExtractorLink) -> Unit
|
||||||
): Boolean {
|
): Boolean {
|
||||||
parseJson<List<String>>(data).map { videoUrl ->
|
parseJson<List<String>>(data).map { videoUrl ->
|
||||||
loadExtractor(unshorten(videoUrl), data, subtitleCallback, callback)
|
loadExtractor(unshorten(videoUrl), data, subtitleCallback, callback)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue