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