From fd6eee635fe4001334c7b5da915960f2577b136f Mon Sep 17 00:00:00 2001 From: Stormunblessed <86633626+Stormunblessed@users.noreply.github.com> Date: Sun, 16 Jan 2022 11:43:44 -0600 Subject: [PATCH] New spanish dubbed site PelisplusHD (#465) * Added PelisplusHD * Update Uqload.kt --- .../com/lagradost/cloudstream3/MainAPI.kt | 1 + .../cloudstream3/extractors/SBPlay.kt | 4 + .../cloudstream3/extractors/Uqload.kt | 6 +- .../movieproviders/PelisplusHDProvider.kt | 173 ++++++++++++++++++ .../cloudstream3/utils/ExtractorApi.kt | 2 + 5 files changed, 185 insertions(+), 1 deletion(-) create mode 100644 app/src/main/java/com/lagradost/cloudstream3/movieproviders/PelisplusHDProvider.kt diff --git a/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt b/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt index 4b30ca87..23403ad4 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt @@ -29,6 +29,7 @@ object APIHolder { val apis = arrayListOf( PelisplusProvider(), + PelisplusHDProvider(), GogoanimeProvider(), AllAnimeProvider(), //ShiroProvider(), // v2 fucked me diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/SBPlay.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/SBPlay.kt index 92068c80..d01ec99a 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/extractors/SBPlay.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/SBPlay.kt @@ -17,6 +17,10 @@ class SBPlay2 : SBPlay() { override val mainUrl = "https://sbplay2.com" } +class SBPlay3 : SBPlay() { + override val mainUrl = "https://pelistop.co" +} + open class SBPlay : ExtractorApi() { override val mainUrl = "https://sbplay.one" override val name = "SBPlay" diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/Uqload.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/Uqload.kt index 4d427a6e..469ec83b 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/extractors/Uqload.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/Uqload.kt @@ -3,7 +3,11 @@ package com.lagradost.cloudstream3.extractors import com.lagradost.cloudstream3.utils.* import com.lagradost.cloudstream3.app -class Uqload : ExtractorApi() { +class Uqload1 : Uqload() { + override val mainUrl = "https://uqload.com" +} + +open class Uqload : ExtractorApi() { override val name: String = "Uqload" override val mainUrl: String = "https://www.uqload.com" private val srcRegex = Regex("""sources:.\[(.*?)\]""") // would be possible to use the parse and find src attribute diff --git a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/PelisplusHDProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/PelisplusHDProvider.kt new file mode 100644 index 00000000..ba4377e8 --- /dev/null +++ b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/PelisplusHDProvider.kt @@ -0,0 +1,173 @@ +package com.lagradost.cloudstream3.movieproviders + +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.utils.* +import org.jsoup.Jsoup +import java.util.* + +class PelisplusHDProvider:MainAPI() { + override val mainUrl: String + get() = "https://pelisplushd.net" + override val name: String + get() = "PelisplusHD" + override val lang = "es" + override val hasMainPage = true + override val hasChromecastSupport = true + override val hasDownloadSupport = true + override val supportedTypes = setOf( + TvType.Movie, + TvType.TvSeries, + TvType.Anime, + ) + override fun getMainPage(): HomePageResponse { + val items = ArrayList() + val urls = listOf( + Pair("$mainUrl/peliculas", "Peliculas"), + Pair("$mainUrl/series", "Series"), + Pair("$mainUrl/generos/dorama", "Doramas"), + Pair("$mainUrl/animes", "Animes"), + ) + for (i in urls) { + try { + val response = app.get(i.first) + val soup = Jsoup.parse(response.text) + val home = soup.select("a.Posters-link").map { + val title = it.selectFirst(".listing-content p").text() + val link = it.selectFirst("a").attr("href") + TvSeriesSearchResponse( + title, + link, + this.name, + if (link.contains("/pelicula/")) TvType.Movie else TvType.TvSeries, + it.selectFirst(".Posters-img").attr("src"), + null, + null, + ) + } + + items.add(HomePageList(i.second, home)) + } catch (e: Exception) { + e.printStackTrace() + } + } + + if (items.size <= 0) throw ErrorLoadingException() + return HomePageResponse(items) + } + + override fun search(query: String): List { + val url = "https://pelisplushd.net/search?s=${query}" + val html = app.get(url).text + val document = Jsoup.parse(html) + + return document.select("a.Posters-link").map { + val title = it.selectFirst(".listing-content p").text() + val href = it.selectFirst("a").attr("href") + val image = it.selectFirst(".Posters-img").attr("src") + val isMovie = href.contains("/pelicula/") + + if (isMovie) { + MovieSearchResponse( + title, + href, + this.name, + TvType.Movie, + image, + null + ) + } else { + TvSeriesSearchResponse( + title, + href, + this.name, + TvType.TvSeries, + image, + null, + null + ) + } + } + } + + override fun load(url: String): LoadResponse? { + val html = app.get(url).text + val soup = Jsoup.parse(html) + + val title = soup.selectFirst(".m-b-5").text() + val description = soup.selectFirst("div.text-large")?.text()?.trim() + val poster: String? = soup.selectFirst(".img-fluid").attr("src") + val episodes = soup.select("div.tab-pane .btn").map { li -> + val href = li.selectFirst("a").attr("href") + TvSeriesEpisode( + null, + null, + null, + href, + ) + } + + val year = soup.selectFirst(".p-r-15 .text-semibold").text().toIntOrNull() + val tvType = if (url.contains("/pelicula/")) TvType.Movie else TvType.TvSeries + val tags = soup.select(".p-h-15.text-center a span.font-size-18.text-info.text-semibold") + .map { it?.text()?.trim().toString().replace(", ","") } + + return when (tvType) { + TvType.TvSeries -> { + TvSeriesLoadResponse( + title, + url, + this.name, + tvType, + episodes, + poster, + year, + description, + ShowStatus.Ongoing, + null, + null, + tags, + ) + } + TvType.Movie -> { + MovieLoadResponse( + title, + url, + this.name, + tvType, + url, + poster, + year, + description, + null, + null, + tags, + ) + } + else -> null + } + } + override fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + val html = app.get(data).text + val soup = Jsoup.parse(html) + val selector = soup.selectFirst("div.player > script").toString() + val linkRegex = Regex("""(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&\/\/=]*))""") + val links = linkRegex.findAll(selector).map { + it.value.replace("https://pelisplushd.net/fembed.php?url=","https://www.fembed.com/v/") + }.toList() + for (link in links) { + for (extractor in extractorApis) { + if (link.startsWith(extractor.mainUrl)) { + extractor.getSafeUrl(link, data)?.forEach { + callback(it) + } + } + } + } + return true + } +} \ No newline at end of file diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt index 916862b0..a85fc77e 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt @@ -103,6 +103,7 @@ val extractorApis: Array = arrayOf( Fplayer(), WatchSB(), Uqload(), + Uqload1(), Evoload(), VoeExtractor(), UpstreamExtractor(), @@ -118,6 +119,7 @@ val extractorApis: Array = arrayOf( SBPlay(), SBPlay1(), SBPlay2(), + SBPlay3(), ) fun getExtractorApiFromName(name: String): ExtractorApi {