mirror of
https://github.com/recloudstream/cloudstream-extensions-multilingual.git
synced 2024-08-15 03:15:14 +00:00
fix IlGenioDelloStreamingProvider
This commit is contained in:
parent
192f759647
commit
6065590829
1 changed files with 30 additions and 17 deletions
|
@ -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,35 @@ 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 ->
|
||||||
data = urls,
|
val subtag = episode.selectFirst("li.season-no")?.text()?.takeIf {it.contains("Sub")}?.substringAfter(" ") ?: ""
|
||||||
episode = index + 1,
|
val urls = episode.getElementsByAttributeValue("target", "_blank").map { it.attr("href").trim() }
|
||||||
season = season + 1
|
.filter { it.isNotEmpty()}.toJson()
|
||||||
)
|
|
||||||
)
|
episodeList.add(Episode(
|
||||||
|
data = urls,
|
||||||
|
posterUrl = posterUrl,
|
||||||
|
season = seasons.key.toIntOrNull(),
|
||||||
|
name = "$epName ${subtag.uppercase()}",
|
||||||
|
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
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()}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue