Fixes and removed interceptor in main page

This commit is contained in:
contusionglory 2022-12-10 13:38:28 +00:00 committed by GitHub
parent 453fbd6ea0
commit 44885f5256
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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,7 +18,7 @@ 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
@ -36,7 +37,7 @@ class IlGenioDelloStreamingProvider : MainAPI() {
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)
@ -46,6 +47,7 @@ class IlGenioDelloStreamingProvider : MainAPI() {
val title =
this.selectFirst("div.data>h3")
?.text()
?.trim()
?.replace("[HD]", "")
?.replace("\\(\\d{4}\\)".toRegex(), "")
?: "No title"
@ -58,19 +60,15 @@ class IlGenioDelloStreamingProvider : MainAPI() {
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) }
}
}
}
@ -86,6 +84,7 @@ class IlGenioDelloStreamingProvider : MainAPI() {
val title =
this.selectFirst("div.title>a")
?.text()
?.trim()
?.replace("[HD]", "")
?.replace("\\(\\d{4}\\)".toRegex(), "")
?: "No title"
@ -99,15 +98,15 @@ class IlGenioDelloStreamingProvider : MainAPI() {
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,7 +116,7 @@ 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
@ -125,6 +124,7 @@ class IlGenioDelloStreamingProvider : MainAPI() {
val title =
document.selectFirst("div.data > h1")
?.text()
?.trim()
?.substringBefore("Streaming")
?.replace("[HD]", "")
?.replace("\\(\\d{4}\\)".toRegex(), "")
@ -197,6 +197,7 @@ class IlGenioDelloStreamingProvider : MainAPI() {
val title =
this.selectFirst("div.data>h3")
?.text()
?.trim()
?.replace("[HD]", "")
?.replace("\\(\\d{4}\\)".toRegex(), "")
?: "No title"
@ -209,15 +210,15 @@ class IlGenioDelloStreamingProvider : MainAPI() {
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)
@ -231,10 +232,18 @@ class IlGenioDelloStreamingProvider : MainAPI() {
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()
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(