From a535ba088dae4df69821ef755f1d06a09156d2d8 Mon Sep 17 00:00:00 2001 From: antonydp <38143733+antonydp@users.noreply.github.com> Date: Sat, 8 Oct 2022 22:51:16 +0200 Subject: [PATCH] Some fixes on Italian providers (#29) --- AltadefinizioneProvider/build.gradle.kts | 2 +- AniPlayProvider/build.gradle.kts | 2 +- .../kotlin/com/lagradost/AniPlayProvider.kt | 17 ++ AnimeSaturnProvider/build.gradle.kts | 2 +- .../com/lagradost/AnimeSaturnProvider.kt | 20 ++ AnimeWorldProvider/build.gradle.kts | 2 +- .../com/lagradost/AnimeWorldProvider.kt | 42 +++- CalcioStreamingProvider/build.gradle.kts | 2 +- CineBlogProvider/build.gradle.kts | 2 +- EurostreamingProvider/build.gradle.kts | 2 +- FilmpertuttiProvider/build.gradle.kts | 2 +- GuardaSerieProvider/build.gradle.kts | 26 +++ .../src/main/AndroidManifest.xml | 2 + .../com/lagradost/GuardaSerieProvider.kt | 204 ++++++++++++++++++ .../lagradost/GuardaSerieProviderPlugin.kt | 14 ++ .../build.gradle.kts | 2 +- StarLiveProvider/build.gradle.kts | 25 +++ StarLiveProvider/src/main/AndroidManifest.xml | 2 + .../kotlin/com/lagradost/StarLiveProvider.kt | 145 +++++++++++++ .../com/lagradost/StarLiveProviderPlugin.kt | 14 ++ StreamingcommunityProvider/build.gradle.kts | 4 +- .../lagradost/StreamingcommunityProvider.kt | 29 +-- TantiFilmProvider/build.gradle.kts | 6 +- .../kotlin/com/lagradost/TantiFilmProvider.kt | 4 +- TvItalianaProvider/build.gradle.kts | 2 +- 25 files changed, 542 insertions(+), 32 deletions(-) create mode 100644 GuardaSerieProvider/build.gradle.kts create mode 100644 GuardaSerieProvider/src/main/AndroidManifest.xml create mode 100644 GuardaSerieProvider/src/main/kotlin/com/lagradost/GuardaSerieProvider.kt create mode 100644 GuardaSerieProvider/src/main/kotlin/com/lagradost/GuardaSerieProviderPlugin.kt create mode 100644 StarLiveProvider/build.gradle.kts create mode 100644 StarLiveProvider/src/main/AndroidManifest.xml create mode 100644 StarLiveProvider/src/main/kotlin/com/lagradost/StarLiveProvider.kt create mode 100644 StarLiveProvider/src/main/kotlin/com/lagradost/StarLiveProviderPlugin.kt diff --git a/AltadefinizioneProvider/build.gradle.kts b/AltadefinizioneProvider/build.gradle.kts index 2d177e7..a3097da 100644 --- a/AltadefinizioneProvider/build.gradle.kts +++ b/AltadefinizioneProvider/build.gradle.kts @@ -7,7 +7,7 @@ cloudstream { // All of these properties are optional, you can safely remove them // description = "Lorem Ipsum" - // authors = listOf("Cloudburst") + authors = listOf("Adippe") /** * Status int as the following: diff --git a/AniPlayProvider/build.gradle.kts b/AniPlayProvider/build.gradle.kts index 8929f13..788b96c 100644 --- a/AniPlayProvider/build.gradle.kts +++ b/AniPlayProvider/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 2 +version = 3 cloudstream { diff --git a/AniPlayProvider/src/main/kotlin/com/lagradost/AniPlayProvider.kt b/AniPlayProvider/src/main/kotlin/com/lagradost/AniPlayProvider.kt index 9c5b68b..1aea8ba 100644 --- a/AniPlayProvider/src/main/kotlin/com/lagradost/AniPlayProvider.kt +++ b/AniPlayProvider/src/main/kotlin/com/lagradost/AniPlayProvider.kt @@ -15,6 +15,7 @@ class AniPlayProvider : MainAPI() { override var name = "AniPlay" override var lang = "it" override val hasMainPage = true + override val hasQuickSearch = true private val dubIdentifier = " (ITA)" override val supportedTypes = setOf( @@ -133,6 +134,22 @@ class AniPlayProvider : MainAPI() { return HomePageResponse(listOf(HomePageList("Ultime uscite",results))) } + override suspend fun quickSearch(query: String): List? { + val response = parseJson>(app.get("$mainUrl/api/anime/search?query=$query").text) + + return response.map { + val isDub = isDub(it.title) + + newAnimeSearchResponse( + name = if (isDub) it.title.replace(dubIdentifier, "") else it.title, + url = "$mainUrl/api/anime/${it.id}", + type = getType(it.type), + ){ + addDubStatus(isDub) + this.posterUrl = it.posters.first().posterUrl + } + } + } override suspend fun search(query: String): List { val response = parseJson>(app.get("$mainUrl/api/anime/advanced-search?page=0&size=36&query=$query").text) diff --git a/AnimeSaturnProvider/build.gradle.kts b/AnimeSaturnProvider/build.gradle.kts index 09242e2..dcb2306 100644 --- a/AnimeSaturnProvider/build.gradle.kts +++ b/AnimeSaturnProvider/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 1 +version = 2 cloudstream { diff --git a/AnimeSaturnProvider/src/main/kotlin/com/lagradost/AnimeSaturnProvider.kt b/AnimeSaturnProvider/src/main/kotlin/com/lagradost/AnimeSaturnProvider.kt index dadb2b5..39ac195 100644 --- a/AnimeSaturnProvider/src/main/kotlin/com/lagradost/AnimeSaturnProvider.kt +++ b/AnimeSaturnProvider/src/main/kotlin/com/lagradost/AnimeSaturnProvider.kt @@ -1,10 +1,12 @@ package com.lagradost +import com.fasterxml.jackson.annotation.JsonProperty import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.LoadResponse.Companion.addAniListId import com.lagradost.cloudstream3.LoadResponse.Companion.addDuration import com.lagradost.cloudstream3.LoadResponse.Companion.addMalId import com.lagradost.cloudstream3.LoadResponse.Companion.addRating +import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.Qualities import org.jsoup.nodes.Element @@ -14,6 +16,7 @@ class AnimeSaturnProvider : MainAPI() { override var name = "AnimeSaturn" override var lang = "it" override val hasMainPage = true + override val hasQuickSearch = true override val supportedTypes = setOf( TvType.Anime, @@ -21,6 +24,12 @@ class AnimeSaturnProvider : MainAPI() { TvType.OVA ) + private data class QuickSearchParse( + @JsonProperty("link") val link: String, + @JsonProperty("image") val image: String, + @JsonProperty("name") val name: String + ) + companion object { fun getStatus(t: String?): ShowStatus? { return when (t?.lowercase()) { @@ -91,6 +100,17 @@ class AnimeSaturnProvider : MainAPI() { return HomePageResponse(list) } + override suspend fun quickSearch(query: String): List? { + val quickSearchJ = app.get("$mainUrl/index.php?search=1&key=$query").text + return tryParseJson>(quickSearchJ)?.map { + newAnimeSearchResponse(it.name.replace(" (ITA)", ""), it.link, TvType.Anime) { + addDubStatus(it.name.contains(" (ITA)")) + this.posterUrl = it.image + } + } + + } + override suspend fun search(query: String): List { val document = app.get("$mainUrl/animelist?search=$query").document return document.select("div.item-archivio").map { diff --git a/AnimeWorldProvider/build.gradle.kts b/AnimeWorldProvider/build.gradle.kts index 35d5f26..231e63b 100644 --- a/AnimeWorldProvider/build.gradle.kts +++ b/AnimeWorldProvider/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 1 +version = 2 cloudstream { diff --git a/AnimeWorldProvider/src/main/kotlin/com/lagradost/AnimeWorldProvider.kt b/AnimeWorldProvider/src/main/kotlin/com/lagradost/AnimeWorldProvider.kt index 3d454cb..8602123 100644 --- a/AnimeWorldProvider/src/main/kotlin/com/lagradost/AnimeWorldProvider.kt +++ b/AnimeWorldProvider/src/main/kotlin/com/lagradost/AnimeWorldProvider.kt @@ -21,6 +21,7 @@ class AnimeWorldProvider : MainAPI() { override var name = "AnimeWorld" override var lang = "it" override val hasMainPage = true + override val hasQuickSearch = true override val supportedTypes = setOf( TvType.Anime, @@ -30,7 +31,7 @@ class AnimeWorldProvider : MainAPI() { companion object { private var cookies = emptyMap() - + private lateinit var token : String // Disabled authentication as site did private suspend fun request(url: String): NiceResponse { // if (cookies.isEmpty()) { @@ -131,9 +132,12 @@ class AnimeWorldProvider : MainAPI() { } override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse { - val document = request(mainUrl).document + val pagedata = request(mainUrl) + val document = pagedata.document val list = ArrayList() - + token = document.getElementById("csrf-token")?.attr("content")?:"" + cookies = pagedata.cookies + val widget = document.select(".widget.hotnew") widget.select(".tabs [data-name=\"sub\"], .tabs [data-name=\"dub\"]").forEach { tab -> val tabId = tab.attr("data-name") @@ -154,6 +158,38 @@ class AnimeWorldProvider : MainAPI() { return HomePageResponse(list) } + data class searchJson( + @JsonProperty("animes") val animes: List + ) + data class animejson( + @JsonProperty("name") val name: String, + @JsonProperty("image") val image: String, + @JsonProperty("link") val link: String, + @JsonProperty("animeTypeName") val type: String, + @JsonProperty("language") val language: String, + @JsonProperty("jtitle") val otherTitle: String + ) + + override suspend fun quickSearch(query: String): List? { + val document = app.post("https://www.animeworld.tv/api/search/v2?keyword=${query}", referer = mainUrl, cookies = cookies, headers = mapOf("csrf-token" to token)).text + + return tryParseJson(document)?.animes?.map { anime-> + val type = when (anime.type) { + "Movie" -> TvType.AnimeMovie + "OVA" -> TvType.OVA + else -> TvType.Anime + } + val dub = when (anime.language) { + "it" -> true + else -> false + } + newAnimeSearchResponse(anime.name, anime.link, type) { + addDubStatus(dub) + this.otherName = anime.otherTitle + this.posterUrl = anime.image + } + } + } override suspend fun search(query: String): List { val document = request("$mainUrl/search?keyword=$query").document return document.select(".film-list > .item").map { diff --git a/CalcioStreamingProvider/build.gradle.kts b/CalcioStreamingProvider/build.gradle.kts index 7bf0bc2..62e5f0b 100644 --- a/CalcioStreamingProvider/build.gradle.kts +++ b/CalcioStreamingProvider/build.gradle.kts @@ -7,7 +7,7 @@ cloudstream { // All of these properties are optional, you can safely remove them // description = "Lorem Ipsum" - // authors = listOf("Cloudburst") + authors = listOf("Adippe") /** * Status int as the following: diff --git a/CineBlogProvider/build.gradle.kts b/CineBlogProvider/build.gradle.kts index 88ebf30..f4c36d0 100644 --- a/CineBlogProvider/build.gradle.kts +++ b/CineBlogProvider/build.gradle.kts @@ -7,7 +7,7 @@ cloudstream { // All of these properties are optional, you can safely remove them // description = "Lorem Ipsum" - // authors = listOf("Cloudburst") + authors = listOf("Adippe") /** * Status int as the following: diff --git a/EurostreamingProvider/build.gradle.kts b/EurostreamingProvider/build.gradle.kts index fa19a12..62f8d76 100644 --- a/EurostreamingProvider/build.gradle.kts +++ b/EurostreamingProvider/build.gradle.kts @@ -7,7 +7,7 @@ cloudstream { // All of these properties are optional, you can safely remove them // description = "Lorem Ipsum" - // authors = listOf("Cloudburst") + authors = listOf("Adippe") /** * Status int as the following: diff --git a/FilmpertuttiProvider/build.gradle.kts b/FilmpertuttiProvider/build.gradle.kts index 0c1c8ba..109d398 100644 --- a/FilmpertuttiProvider/build.gradle.kts +++ b/FilmpertuttiProvider/build.gradle.kts @@ -7,7 +7,7 @@ cloudstream { // All of these properties are optional, you can safely remove them // description = "Lorem Ipsum" - // authors = listOf("Cloudburst") + authors = listOf("Adippe") /** * Status int as the following: diff --git a/GuardaSerieProvider/build.gradle.kts b/GuardaSerieProvider/build.gradle.kts new file mode 100644 index 0000000..d95fc03 --- /dev/null +++ b/GuardaSerieProvider/build.gradle.kts @@ -0,0 +1,26 @@ +// use an integer for version numbers +version = 1 + + +cloudstream { + language = "it" + // All of these properties are optional, you can safely remove them + + // description = "Lorem Ipsum" + authors = listOf("Adippe") + + /** + * Status int as the following: + * 0: Down + * 1: Ok + * 2: Slow + * 3: Beta only + * */ + status = 1 // will be 3 if unspecified + tvTypes = listOf( + "TvSeries", + "Movie", + ) + + iconUrl = "https://www.google.com/s2/favicons?domain=guardaserie.golf&sz=%size%" +} \ No newline at end of file diff --git a/GuardaSerieProvider/src/main/AndroidManifest.xml b/GuardaSerieProvider/src/main/AndroidManifest.xml new file mode 100644 index 0000000..29aec9d --- /dev/null +++ b/GuardaSerieProvider/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/GuardaSerieProvider/src/main/kotlin/com/lagradost/GuardaSerieProvider.kt b/GuardaSerieProvider/src/main/kotlin/com/lagradost/GuardaSerieProvider.kt new file mode 100644 index 0000000..026c69d --- /dev/null +++ b/GuardaSerieProvider/src/main/kotlin/com/lagradost/GuardaSerieProvider.kt @@ -0,0 +1,204 @@ +package com.lagradost + +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.LoadResponse.Companion.addAniListId +import com.lagradost.cloudstream3.LoadResponse.Companion.addDuration +import com.lagradost.cloudstream3.LoadResponse.Companion.addMalId +import com.lagradost.cloudstream3.LoadResponse.Companion.addRating +import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer +import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson +import com.lagradost.cloudstream3.utils.Coroutines.main +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.Qualities +import com.lagradost.cloudstream3.utils.loadExtractor +import com.lagradost.nicehttp.NiceResponse +import org.jsoup.nodes.Element +import org.mozilla.javascript.ConsString +import org.mozilla.javascript.Context +import org.mozilla.javascript.Scriptable + +class GuardaSerieProvider : MainAPI() { + override var mainUrl = "https://guardaserie.golf" + override var name = "GuardaSerie" + override var lang = "it" + override val hasMainPage = true + override val hasQuickSearch = true + override val supportedTypes = setOf( + TvType.TvSeries, + TvType.Movie + ) + override val mainPage = mainPageOf( + Pair("$mainUrl/stagioni/page/", "Ultime Serie Tv"), + Pair("$mainUrl/viste/page/", "Film e Serie piĆ¹ viste"), + Pair("$mainUrl/votati/page/", "Ora al cinema") + ) + companion object { + private lateinit var token : String + } + + data class QuickSearchParser ( + @JsonProperty ("title") val title : String? = null, + @JsonProperty ("url") val url : String? = null, + @JsonProperty ("img") val img : String? = null + ) + + + override suspend fun search(query: String): List { + val queryFormatted = query.replace(" ", "+") + val url = "$mainUrl?s=$queryFormatted" + val doc = app.get(url,referer= mainUrl ).document + return doc.select("div.result-item").map { + 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().substringBefore("(") + MovieSearchResponse( + name, + href, + this.name, + TvType.Movie, + poster + ) + + } + } + + override suspend fun quickSearch(query: String): List? { + val response = app.get("$mainUrl/wp-json/dooplay/search/?keyword=$query&nonce=$token").text + val p = tryParseJson>(response)?.values?.map { + MovieSearchResponse( + name = it.title!!, + url = it.url!!, + posterUrl = it.img!!, + type = TvType.Movie, + apiName = this.name + ) + } + + return p + } + override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse { + val url = request.data + page + val soup = app.get(url).document + + token = Regex("nonce\":\"[^\"]*").find(app.get(mainUrl).toString())?.value?.drop(8)?:"" + val home = soup.select("article").map { + val title = it.selectFirst("img")!!.attr("alt") + val link = it.selectFirst("a")!!.attr("href") + val image = it.selectFirst("img")!!.attr("src") + val quality = getQualityFromString(it.selectFirst("span.quality")?.text()) + + MovieSearchResponse( + title, + link, + this.name, + TvType.Movie, + image, + null, + null, + quality, + ) + } + return newHomePageResponse(request.name, home) + } + + override suspend fun load(url: String): LoadResponse { + val document = app.get(url).document + val name = document.selectFirst("h1")!!.text() + val poster = document.selectFirst("div.poster")?.selectFirst("img")!!.attr("src") + val rating = document.selectFirst("span.dt_rating_vgs")!!.text().toIntOrNull() + val tags = document.select("div.sgeneros > a").map { it.text() } + val actors = document.select("div.person").map { + val actorName = it.selectFirst("div.name > a")!!.text() + val actorPoster = it.selectFirst("img")?.attr("src") + val role = it.selectFirst("div.caracter")?.text() + ActorData(Actor(actorName, actorPoster), roleString = role ) + } + if(url.contains("/film/")){ + val description = document.selectFirst("div.wp-content > p")!!.text() + val year = document.selectFirst("span.date")!!.text().substringAfterLast(" ").toIntOrNull() + val recomm = document.selectFirst("div.sbox.srelacionados")?.select("article")?.map{ + MovieSearchResponse( + name = it.selectFirst("img")!!.attr("alt"), + url = it.selectFirst("a")!!.attr("href"), + this.name, + TvType.Movie, + posterUrl = it.selectFirst("img")!!.attr("src"), + null + ) + } + val duration = document.selectFirst("div.runtime")?.text()?.filter { it.isDigit() }?.toIntOrNull() + return newMovieLoadResponse( + name = name, + url = url, + type = TvType.Movie, + dataUrl = url + ) { + posterUrl = fixUrlNull(poster) + this.year = year + this.plot = description + this.rating = rating + this.recommendations = recomm + this.duration = duration + this.actors = actors + this.tags = tags + } + } + else{ + val episodes = document.select("#seasons > div").reversed().mapIndexed{season, data-> + data.select("li").mapIndexed { epNum , ep -> + val href = ep.selectFirst("a")!!.attr("href") + val epTitle = ep.selectFirst("a")?.text() + val posterUrl = ep.selectFirst("img")?.attr("src") + Episode( + href, + epTitle, + season + 1, + epNum + 1, + posterUrl, + ) + } + + } + val plot = document.selectFirst("#info > div.wp-content > p")?.text() + return newTvSeriesLoadResponse( + name = name, + url = url, + type = TvType.TvSeries, + episodes = episodes.flatten(), + ){ + this.posterUrl = poster + this.rating = rating + this.tags = tags + this.actors = actors + this.plot = plot + } + } + } + + + override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + val doc = app.get(data).document + val type = if( data.contains("film") ){"movie"} else {"tv"} + val idpost = doc.select("#player-option-1").attr("data-post") + val postInfo = app.post("$mainUrl/wp-admin/admin-ajax.php", headers = mapOf( + "content-type" to "application/x-www-form-urlencoded; charset=UTF-8", + "accept" to "*/*", + "X-Requested-With" to "XMLHttpRequest", + ), data = mapOf( + "action" to "doo_player_ajax", + "post" to idpost, + "nume" to "1", + "type" to type, + )) + + val url= Regex("""src='((.|\\n)*?)'""").find(postInfo.text)?.groups?.get(1)?.value.toString() + val streamUrl = app.get(url, headers = mapOf("referer" to mainUrl)).url + return loadExtractor(streamUrl, data, subtitleCallback, callback) + } +} \ No newline at end of file diff --git a/GuardaSerieProvider/src/main/kotlin/com/lagradost/GuardaSerieProviderPlugin.kt b/GuardaSerieProvider/src/main/kotlin/com/lagradost/GuardaSerieProviderPlugin.kt new file mode 100644 index 0000000..c0a0708 --- /dev/null +++ b/GuardaSerieProvider/src/main/kotlin/com/lagradost/GuardaSerieProviderPlugin.kt @@ -0,0 +1,14 @@ + +package com.lagradost + +import com.lagradost.cloudstream3.plugins.CloudstreamPlugin +import com.lagradost.cloudstream3.plugins.Plugin +import android.content.Context + +@CloudstreamPlugin +class GuardaSerieProviderPlugin: Plugin() { + override fun load(context: Context) { + // All providers should be added in this manner. Please don't edit the providers list directly. + registerMainAPI(GuardaSerieProvider()) + } +} \ No newline at end of file diff --git a/IlGenioDelloStreamingProvider/build.gradle.kts b/IlGenioDelloStreamingProvider/build.gradle.kts index 112f2e5..9e263d9 100644 --- a/IlGenioDelloStreamingProvider/build.gradle.kts +++ b/IlGenioDelloStreamingProvider/build.gradle.kts @@ -7,7 +7,7 @@ cloudstream { // All of these properties are optional, you can safely remove them // description = "Lorem Ipsum" - // authors = listOf("Cloudburst") + authors = listOf("Adippe") /** * Status int as the following: diff --git a/StarLiveProvider/build.gradle.kts b/StarLiveProvider/build.gradle.kts new file mode 100644 index 0000000..e02ba85 --- /dev/null +++ b/StarLiveProvider/build.gradle.kts @@ -0,0 +1,25 @@ +// use an integer for version numbers +version = 1 + + +cloudstream { + language = "it" + // All of these properties are optional, you can safely remove them + + // description = "Lorem Ipsum" + authors = listOf("Adippe") + + /** + * Status int as the following: + * 0: Down + * 1: Ok + * 2: Slow + * 3: Beta only + * */ + status = 1 // will be 3 if unspecified + tvTypes = listOf( + "Live", + ) + + iconUrl = "https://www.google.com/s2/favicons?domain=starlive.xyz&sz=%size%" +} \ No newline at end of file diff --git a/StarLiveProvider/src/main/AndroidManifest.xml b/StarLiveProvider/src/main/AndroidManifest.xml new file mode 100644 index 0000000..29aec9d --- /dev/null +++ b/StarLiveProvider/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/StarLiveProvider/src/main/kotlin/com/lagradost/StarLiveProvider.kt b/StarLiveProvider/src/main/kotlin/com/lagradost/StarLiveProvider.kt new file mode 100644 index 0000000..dd0068e --- /dev/null +++ b/StarLiveProvider/src/main/kotlin/com/lagradost/StarLiveProvider.kt @@ -0,0 +1,145 @@ +package com.lagradost + +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.utils.* +import com.lagradost.cloudstream3.utils.AppUtils.toJson +import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson + +class StarLiveProvider : MainAPI() { + override var mainUrl = "https://starlive.xyz" + override var name = "StarLive" + override val hasMainPage = true + override var lang = "it" + override val hasChromecastSupport = true + override val supportedTypes = setOf(TvType.Live) + + private data class LinkParser( + @JsonProperty("link") val link: String, + @JsonProperty("lang") val language: String, + @JsonProperty("name") val name: String + ) + + private data class MatchDataParser( + @JsonProperty("time") val time: String, + @JsonProperty("poster") val poster: String + ) + + private data class MatchParser( + @JsonProperty("linkData") val linkData: List, + @JsonProperty("matchData") val MatchData: MatchDataParser + ) + + + override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse { + val document = app.get(mainUrl).document + val sections = document.select("div.panel") + if (sections.isEmpty()) throw ErrorLoadingException() + + return HomePageResponse(sections.mapNotNull { sport -> + val dayMatch = sport.previousElementSiblings().toList().first { it.`is`("h3") }.text() + val categoryName = sport.selectFirst("h4")?.text() ?: "Other" + + val showsList = sport.select("tr").takeWhile { it.text().contains("Player").not() } + .filter { it.hasAttr("class") }.drop(1) + + val shows = showsList.groupBy { it.text().substringBeforeLast(" ") }.map { matchs -> + val posterUrl = fixUrl( + sport.selectFirst("h4")?.attr("style") + ?.substringAfter("(")?.substringBefore(")") ?: "" + ) + val hasDate = matchs.key.contains(":") + val matchName = if (hasDate) { matchs.key.substringAfter(" ")} + else { matchs.key } + + val href = matchs.value.map { match -> + val linkUrl = fixUrl(match.selectFirst("a")?.attr("href") ?: return@mapNotNull null) + val lang = match.attr("class") + LinkParser(linkUrl, lang, matchName) + } + + val date = if (hasDate) { + dayMatch + " - " + matchs.key.substringBefore(" ") + } else { + dayMatch + } + + LiveSearchResponse( + matchName, + MatchParser(href, MatchDataParser(date, posterUrl)).toJson(), + this@StarLiveProvider.name, + TvType.Live, + posterUrl, + ) + } + HomePageList( + categoryName, + shows + ) + + }) + + } + + override suspend fun load(url: String): LoadResponse { + val matchdata = tryParseJson(url) + val poster = matchdata?.MatchData?.poster + val matchstart = matchdata?.MatchData?.time + return LiveStreamLoadResponse( + dataUrl = url, + url = matchdata?.linkData?.firstOrNull()?.link ?: mainUrl, + name = matchdata?.linkData?.firstOrNull()?.name ?: "No name", + posterUrl = poster, + plot = matchstart, + apiName = this@StarLiveProvider.name + ) + } + + private suspend fun extractVideoLinks( + data: LinkParser, + callback: (ExtractorLink) -> Unit + ) { + val linktoStream = fixUrl(app.get(data.link).document.selectFirst("iframe")!!.attr("src")) + + val referrerLink = if (linktoStream.contains("starlive")) { + app.get(linktoStream, referer = data.link).document.selectFirst("iframe")?.attr("src") + ?: return + } else { + linktoStream + } + val packed = when (linktoStream.contains("starlive")) { + true -> app.get( + referrerLink, + referer = linktoStream + ).document.select("script").toString() + false -> app.get(linktoStream, referer = data.link).document.select("script") + .select("script").toString() + } + val streamUrl = getAndUnpack(packed).substringAfter("var src=\"").substringBefore("\"") + callback( + ExtractorLink( + source = this.name, + name = data.name + " - " + data.language, + url = streamUrl, + quality = Qualities.Unknown.value, + referer = referrerLink, + isM3u8 = true + ) + ) + + } + + + override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + tryParseJson(data)?.linkData?.map { link -> + extractVideoLinks(link, callback) + } + + return true + } +} \ No newline at end of file diff --git a/StarLiveProvider/src/main/kotlin/com/lagradost/StarLiveProviderPlugin.kt b/StarLiveProvider/src/main/kotlin/com/lagradost/StarLiveProviderPlugin.kt new file mode 100644 index 0000000..60d6bee --- /dev/null +++ b/StarLiveProvider/src/main/kotlin/com/lagradost/StarLiveProviderPlugin.kt @@ -0,0 +1,14 @@ + +package com.lagradost + +import com.lagradost.cloudstream3.plugins.CloudstreamPlugin +import com.lagradost.cloudstream3.plugins.Plugin +import android.content.Context + +@CloudstreamPlugin +class StarLiveProviderPlugin: Plugin() { + override fun load(context: Context) { + // All providers should be added in this manner. Please don't edit the providers list directly. + registerMainAPI(StarLiveProvider()) + } +} \ No newline at end of file diff --git a/StreamingcommunityProvider/build.gradle.kts b/StreamingcommunityProvider/build.gradle.kts index eb0eef0..1a8e42d 100644 --- a/StreamingcommunityProvider/build.gradle.kts +++ b/StreamingcommunityProvider/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 2 +version = 3 cloudstream { @@ -7,7 +7,7 @@ cloudstream { // All of these properties are optional, you can safely remove them // description = "Lorem Ipsum" - // authors = listOf("Cloudburst") + authors = listOf("Adippe") /** * Status int as the following: diff --git a/StreamingcommunityProvider/src/main/kotlin/com/lagradost/StreamingcommunityProvider.kt b/StreamingcommunityProvider/src/main/kotlin/com/lagradost/StreamingcommunityProvider.kt index b3cc074..e8b71d1 100644 --- a/StreamingcommunityProvider/src/main/kotlin/com/lagradost/StreamingcommunityProvider.kt +++ b/StreamingcommunityProvider/src/main/kotlin/com/lagradost/StreamingcommunityProvider.kt @@ -2,10 +2,10 @@ package com.lagradost import android.text.Html import com.fasterxml.jackson.annotation.* -import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.utils.AppUtils.parseJson import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer import com.lagradost.cloudstream3.utils.* +import com.lagradost.cloudstream3.* import org.json.JSONObject import java.net.URI import java.security.MessageDigest @@ -126,10 +126,10 @@ data class TrailerElement( ) -class StreamingcommunityProvider : MainAPI() { +class StreamingcommunityProvider: MainAPI() { override var lang = "it" - override var mainUrl = "https://streamingcommunity.tech" - override var name = "Streamingcommunity" + override var mainUrl = "https://streamingcommunity.golf" + override var name = "StreamingCommunity" override val hasMainPage = true override val hasChromecastSupport = true override val supportedTypes = setOf( @@ -183,7 +183,7 @@ class StreamingcommunityProvider : MainAPI() { val lista = mutableListOf() val videoData = parseJson>(films) - videoData.subList(0, 12).map { searchr -> + videoData.subList(0, 12).apmap { searchr -> val id = searchr.id val name = searchr.slug val img = searchr.images[0].url @@ -229,7 +229,7 @@ class StreamingcommunityProvider : MainAPI() { document.selectFirst("the-search-page")!!.attr("records-json").replace(""", """"""") val searchresults = parseJson>(films) - return searchresults.map { result -> + return searchresults.apmap { result -> val id = result.id val name = result.slug val img = result.images[0].url @@ -296,7 +296,7 @@ class StreamingcommunityProvider : MainAPI() { val correlatidata = parseJson>(correlatijs) val number : Int = if (correlatidata.size<=15) {correlatidata.size} else correlatidata.size-15 - correlatidata.take(number).map { searchr -> + correlatidata.take(number).apmap { searchr -> val idcorr = searchr.id val name = searchr.slug val img = searchr.images[0].url @@ -425,13 +425,18 @@ class StreamingcommunityProvider : MainAPI() { val scwsid = jsn.getString("scws_id") val expire = (System.currentTimeMillis() / 1000 + 172800).toString() - val uno = "$expire$ip Yc8U6r8KjAKAepEA".toByteArray() - val due = MessageDigest.getInstance("MD5").digest(uno) - val tre = base64Encode(due) - val token = tre.replace("=", "").replace("+", "-").replace("/", "_") + val token0 = "$expire$ip Yc8U6r8KjAKAepEA".toByteArray() + val token1 = MessageDigest.getInstance("MD5").digest(token0) + val token2 = base64Encode(token1) + val token = token2.replace("=", "").replace("+", "-").replace("/", "_") + val link = "https://scws.work/master/$scwsid?token=$token&expires=$expire&n=1" + Regex("URI=\".*\"").findAll(app.get("https://scws.work/master/$scwsid?token=$token&expires=$expire&n=1").text).toList().filter{it.value.contains("auto-forced").not()}.map{ + val link = app.get(it.value.substringAfter("\"").dropLast(1)).text.lines().filter{it.contains("http")}[0] + val lang = it.value.substringAfter("rendition=").substringBefore("&") + SubtitleFile(lang, link) + }.forEach(subtitleCallback) - val link = "https://scws.xyz/master/$scwsid?token=$token&expires=$expire&n=1&n=1" getM3u8Qualities(link, data, URI(link).host).forEach(callback) return true } diff --git a/TantiFilmProvider/build.gradle.kts b/TantiFilmProvider/build.gradle.kts index f98a6f1..ce09274 100644 --- a/TantiFilmProvider/build.gradle.kts +++ b/TantiFilmProvider/build.gradle.kts @@ -1,5 +1,5 @@ // use an integer for version numbers -version = 1 +version = 2 cloudstream { @@ -7,7 +7,7 @@ cloudstream { // All of these properties are optional, you can safely remove them // description = "Lorem Ipsum" - // authors = listOf("Cloudburst") + authors = listOf("Adippe") /** * Status int as the following: @@ -23,5 +23,5 @@ cloudstream { ) - iconUrl = "https://www.google.com/s2/favicons?domain=tantifilm.autos&sz=%size%" + iconUrl = "https://www.google.com/s2/favicons?domain=tantifilm.yachts&sz=%size%" } \ No newline at end of file diff --git a/TantiFilmProvider/src/main/kotlin/com/lagradost/TantiFilmProvider.kt b/TantiFilmProvider/src/main/kotlin/com/lagradost/TantiFilmProvider.kt index ed1c6e6..8252768 100644 --- a/TantiFilmProvider/src/main/kotlin/com/lagradost/TantiFilmProvider.kt +++ b/TantiFilmProvider/src/main/kotlin/com/lagradost/TantiFilmProvider.kt @@ -9,7 +9,7 @@ import com.lagradost.cloudstream3.network.CloudflareKiller class TantifilmProvider : MainAPI() { override var lang = "it" - override var mainUrl = "https://tantifilm.autos" + override var mainUrl = "https://tantifilm.yachts" override var name = "Tantifilm" override val hasMainPage = true override val hasChromecastSupport = true @@ -242,4 +242,4 @@ class TantifilmProvider : MainAPI() { } return true } -} \ No newline at end of file +} diff --git a/TvItalianaProvider/build.gradle.kts b/TvItalianaProvider/build.gradle.kts index 745691c..187c379 100644 --- a/TvItalianaProvider/build.gradle.kts +++ b/TvItalianaProvider/build.gradle.kts @@ -7,7 +7,7 @@ cloudstream { // All of these properties are optional, you can safely remove them // description = "Lorem Ipsum" - // authors = listOf("Cloudburst") + authors = listOf("Adippe") /** * Status int as the following: