This commit is contained in:
Clyzer 2023-01-19 11:01:13 -03:00
commit 7405076328
3 changed files with 212 additions and 146 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 4 version = 5
cloudstream { cloudstream {
@ -7,7 +7,7 @@ cloudstream {
// All of these properties are optional, you can safely remove them // All of these properties are optional, you can safely remove them
// description = "Lorem Ipsum" // description = "Lorem Ipsum"
authors = listOf("Adippe") authors = listOf("Adippe","Forthe")
/** /**
* Status int as the following: * Status int as the following:
@ -16,12 +16,11 @@ 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", "TvSeries",
"Movie", "Movie",
) )
iconUrl = "https://www.google.com/s2/favicons?domain=ilgeniodellostreaming.quest&sz=%size%" iconUrl = "https://www.google.com/s2/favicons?domain=ilgeniodellostreaming.hair&sz=%size%"
} }

View file

@ -2,190 +2,247 @@ package com.lagradost
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.MainAPI
import com.lagradost.cloudstream3.SearchResponse
import com.lagradost.cloudstream3.TvType
import com.lagradost.cloudstream3.network.CloudflareKiller import com.lagradost.cloudstream3.network.CloudflareKiller
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
import com.lagradost.cloudstream3.utils.AppUtils.toJson import com.lagradost.cloudstream3.utils.AppUtils.toJson
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.ShortLink import com.lagradost.cloudstream3.utils.ShortLink.unshorten
import com.lagradost.cloudstream3.utils.loadExtractor import com.lagradost.cloudstream3.utils.loadExtractor
import org.jsoup.nodes.Element
class IlGenioDelloStreamingProvider : MainAPI() { class IlGenioDelloStreamingProvider : MainAPI() {
override var lang = "it" override var lang = "it"
override var mainUrl = "https://ilgeniodellostreaming.quest" override var mainUrl = "https://ilgeniodellostreaming.hair"
override var name = "IlGenioDelloStreaming" override var name = "IlGenioDelloStreaming"
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 = setOf( override val supportedTypes =
setOf(
TvType.Movie, TvType.Movie,
TvType.TvSeries, TvType.TvSeries,
) )
override val mainPage = mainPageOf( override val mainPage =
Pair("$mainUrl/category/film/page/", "Film Popolari"), mainPageOf(
Pair("$mainUrl/category/serie-tv/page/", "Serie Tv 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"),
Pair("$mainUrl/prime-visioni/page/", "Ultime uscite"),
) )
private val interceptor = CloudflareKiller() private val interceptor = CloudflareKiller()
override suspend fun getMainPage(
page: Int, private fun fixTitle(element: Element?): String {
request: MainPageRequest return element?.text()
): HomePageResponse { ?.trim()
val url = request.data + page ?.substringBefore("Streaming")
val soup = app.get(url, interceptor = interceptor).document ?.replace("[HD]", "")
val home = soup.select("div.items > article.item").map { ?.replace("\\(\\d{4}\\)".toRegex(), "")
val title = it.selectFirst("div.data > h3 > a")!!.text().substringBeforeLast("(").substringBeforeLast("[") ?: "No Title found"
val link = it.selectFirst("div.poster > a")!!.attr("href") }
val quality = getQualityFromString(it.selectFirst("span.quality")?.text())
TvSeriesSearchResponse( override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
title, val url = request.data + page
link,
this.name, val soup = app.get(url, referer = mainUrl).document
TvType.Movie, val home = soup.select("div.items > article.item").mapNotNull { it.toMainPageResult() }
it.selectFirst("img")!!.attr("src"), val hasNext = home.isNotEmpty()
null, return newHomePageResponse(arrayListOf(HomePageList(request.name, home)), hasNext = hasNext)
null, }
quality = quality
) private fun Element.toMainPageResult(): SearchResponse {
val title =
fixTitle(this.selectFirst("div.data>h3"))
val isMovie =
(this.selectFirst("div.data>h3")?.text() ?: "").contains("\\(\\d{4}\\)".toRegex())
val link =
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")
return if (isMovie) {
newMovieSearchResponse(title, link, TvType.Movie) {
addPoster(posterUrl)
quality?.let { addQuality(it) }
}
} else {
newTvSeriesSearchResponse(title, link, TvType.TvSeries) {
addPoster(posterUrl)
quality?.let { addQuality(it) }
}
} }
return newHomePageResponse(request.name, home)
} }
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?s=$queryformatted" val url = "$mainUrl/?s=$queryFormatted"
val doc = app.get(url, interceptor = interceptor, referer = mainUrl).document val doc = app.get(url, referer = mainUrl, interceptor = interceptor).document
return doc.select("div.result-item").map { return doc.select("div.search-page>div.result-item").map { it.toSearchResult() }
val href = it.selectFirst("div.image > div > a")!!.attr("href") }
val poster = it.selectFirst("div.image > div > a > img")!!.attr("src")
val name = it.selectFirst("div.details > div.title > a")!!.text().substringBeforeLast("(").substringBeforeLast("[")
MovieSearchResponse(
name,
href,
this.name,
TvType.Movie,
poster
)
private fun Element.toSearchResult(): SearchResponse {
val title =
fixTitle(this.selectFirst("div.title>a"))
val isMovie =
(this.selectFirst("div.title>a")?.text() ?: "").contains("\\(\\d{4}\\)".toRegex())
val link =
this.selectFirst("div.title>a")?.attr("href")
?: throw ErrorLoadingException("No Link found")
val quality =
this.selectFirst("div.title>a")?.text()?.substringAfter("[")?.substringBefore("]")
val posterUrl = this.selectFirst("a>img")?.attr("src")
return if (isMovie) {
newMovieSearchResponse(title, link, TvType.Movie) {
addPoster(posterUrl)
if (quality != null) {
addQuality(quality)
}
}
} else {
newTvSeriesSearchResponse(title, link, TvType.TvSeries) {
addPoster(posterUrl)
if (quality != null) {
addQuality(quality)
}
}
} }
} }
override suspend fun load(url: String): LoadResponse { override suspend fun load(url: String): LoadResponse {
val page = app.get(url, interceptor = interceptor) val document = app.get(url, referer = mainUrl).document
val document = page.document val type =
val type = if (document.select("div.seasons-wraper").isNotEmpty()){TvType.TvSeries} else{TvType.Movie} if (document.select("div.seasons-wraper").isNotEmpty()) TvType.TvSeries
val title = document.selectFirst("div.data > h1")!!.text().substringBefore("(").substringBefore("[") else TvType.Movie
val description = document.selectFirst("div#info")?.selectFirst("p")?.html()
val rating = document.select("span.valor").last()?.text()?.split(" ")?.get(0)
var year = document.selectFirst(" div.data > div.extra > span.date")!!.text().substringAfter(",")
.filter { it.isDigit() }
if (year.length > 4) {
year = year.dropLast(4)
}
val poster = document.selectFirst("div.poster > img")!!.attr("src")
val recomm = document.select("article.w_item_b").map {
val href = it.selectFirst("a")!!.attr("href")
val posterUrl = it.selectFirst("img")!!.attr("src")
val name = it.selectFirst("div.data > h3")!!.text().substringBeforeLast("(").substringBeforeLast("[")
MovieSearchResponse(
name,
href,
this.name,
TvType.Movie,
posterUrl
)
}
val title =
fixTitle(document.selectFirst("div.data > h1"))
val description =
document.selectFirst("div#info")
?.text()
?.substringAfter(".")
?.substringBefore("Leggi anche")
val year =
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 =
document.selectFirst("img.youtube__img")
?.attr("src")
?.substringAfter("vi/")
?.substringBefore("/")
?.let { "https://www.youtube.com/watch?v=$it" }
val recomm = document.select("article.w_item_b").map { it.toRecommendResult() }
if (type == TvType.TvSeries) { if (type == TvType.TvSeries) {
val episodeList =
val episodeList = ArrayList<Episode>() document.select("div.accordion>div.accordion-item")
document.selectFirst("div.seasons-wraper") .map { element ->
?.select("div.accordion-item ")?.groupBy {it.selectFirst("span.season-title")!!.text() }?.map { seasons -> val season =
seasons.value.map {season -> season.select("div.episode-wrap")}.flatten() element.selectFirst("li.s_title>span.season-title")
.groupBy { it.selectFirst("li.season-no")?.text()?.substringBeforeLast(" ") } ?.text()
.map { episodeItaSub -> ?.toIntOrNull()
val episodes = episodeItaSub.value ?: 0
val posterUrl = episodes.firstNotNullOf { it.selectFirst("img")?.attr("src")} element.select("div.episode-wrap").map { episode ->
val epName = episodes.firstNotNullOf{it.selectFirst("li.other_link")?.text()?:""} episode.toEpisode(season)
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,
posterUrl = posterUrl,
season = seasons.key.toIntOrNull(),
name = "$epName ${subtag.uppercase()}",
episode = seasonNo?.text()?.substringAfter("x")?.filter { it.isDigit() }?.toIntOrNull()
))
}
} }
} }
.flatten()
return newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodeList) {
val seasonnames = document.selectFirst("div#info")?.select("p")?.map {it.children() } this.year = year?.toIntOrNull()
?.filter { it.size<3 && it.isNotEmpty()}?.map{it.text()}
return newTvSeriesLoadResponse(
title,
url,
type,
episodeList
){
addRating(rating)
this.plot = description this.plot = description
this.year = year.toIntOrNull()
this.posterUrl = poster
this.recommendations = recomm this.recommendations = recomm
this.seasonNames = seasonnames!!.mapIndexed { index, s -> SeasonData(index, s) } addPoster(poster)
addRating(rating)
addTrailer(trailer)
} }
} 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.children()[1].text() val actorName = actordata.selectFirst("strong")?.text() ?: ""
val actorImage : String? = actorData.selectFirst("img")?.attr("data-src") val actorImage: String =
val roleActor = actorData.children()[2].text() actordata.selectFirst("figure>img")?.attr("src") ?: ""
ActorData(actor = Actor(actorName, image = actorImage), roleString = roleActor ) ActorData(actor = Actor(actorName, image = actorImage))
} }
return newMovieLoadResponse( val data = document.select(".embed-player").map { it.attr("data-id") }.toJson()
title, return newMovieLoadResponse(title, data, TvType.Movie, data) {
url, this.year = year?.toIntOrNull()
type,
(document.select("div.embed-player") + document.select("a.link_a")).map { (it.attr("href") + it.attr("data-id")).trim() }.distinct().toJson(),
) {
posterUrl = fixUrlNull(poster)
this.year = year.toIntOrNull()
this.plot = description this.plot = description
addRating(rating)
this.recommendations = recomm
this.duration = null
this.actors = actors this.actors = actors
this.recommendations = recomm
addPoster(poster)
addRating(rating)
addTrailer(trailer)
} }
} }
} }
private fun Element.toRecommendResult(): SearchResponse {
val title =
fixTitle(this.selectFirst("div.data>h3"))
val isMovie =
(this.selectFirst("div.data>h3")?.text() ?: "").contains("\\(\\d{4}\\)".toRegex())
val link =
this.selectFirst("a")?.attr("href") ?: throw ErrorLoadingException("No Link found")
val quality =
this.selectFirst("div.data>h3")?.text()?.substringAfter("[")?.substringBefore("]")
val posterUrl = this.selectFirst("div.image>img")?.attr("src")
return if (isMovie) {
newMovieSearchResponse(title, link, TvType.Movie) {
addPoster(posterUrl)
if (quality != null) {
addQuality(quality)
}
}
} else {
newTvSeriesSearchResponse(title, link, TvType.TvSeries) {
addPoster(posterUrl)
if (quality != null) {
addQuality(quality)
}
}
}
}
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 epNum =
this.selectFirst("li.season-no")
?.text()
?.substringAfter("x")
?.substringBefore(" ")
?.filter { it.isDigit() }
.orEmpty().ifBlank { "0" }
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?.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 {
val links = tryParseJson<List<String>>(data) parseJson<List<String>>(data).map { videoUrl ->
links?.map { link -> loadExtractor(unshorten(videoUrl), data, subtitleCallback, callback)
val url = ShortLink.unshorten(link).replace("/v/", "/e/").replace("/f/", "/e/")
loadExtractor(url, data, subtitleCallback, callback)
} }
return true return true
} }

View file

@ -102,6 +102,7 @@ class MundoDonghuaProvider : MainAPI() {
override suspend fun load(url: String): LoadResponse { override suspend fun load(url: String): LoadResponse {
val doc = app.get(url, timeout = 120).document val doc = app.get(url, timeout = 120).document
val docSpecial = app.get(mainUrl, timeout = 120).document
val poster = doc.selectFirst("head meta[property=og:image]")?.attr("content") ?: "" val poster = doc.selectFirst("head meta[property=og:image]")?.attr("content") ?: ""
val title = doc.selectFirst(".ls-title-serie")?.text() ?: "" val title = doc.selectFirst(".ls-title-serie")?.text() ?: ""
val description = doc.selectFirst("p.text-justify.fc-dark")?.text() ?: "" val description = doc.selectFirst("p.text-justify.fc-dark")?.text() ?: ""
@ -111,6 +112,15 @@ class MundoDonghuaProvider : MainAPI() {
"Finalizada" -> ShowStatus.Completed "Finalizada" -> ShowStatus.Completed
else -> null else -> null
} }
val specialEpisodes = docSpecial.select("div.sm-row.bg-white.pt-10.pr-20.pb-15.pl-20 div.item.col-lg-2.col-md-2.col-xs-4").mapNotNull {
val name = it.selectFirst("h5")?.text()?.replace("Episodio","-") ?: ""
val link = it.selectFirst("a")?.attr("href") ?: ""
if (name.contains(title, true)) {
Episode(fixUrl(link), name)
} else {
null
}
}.reversed()
val episodes = doc.select("ul.donghua-list a").map { val episodes = doc.select("ul.donghua-list a").map {
val name = it.selectFirst(".fs-16")?.text() val name = it.selectFirst(".fs-16")?.text()
val link = it.attr("href") val link = it.attr("href")