Fixes on providers (#535)

* Fixes on providers

* small fix

* fixes
This commit is contained in:
Stormunblessed 2022-01-30 18:25:38 +00:00 committed by GitHub
parent 3fe361586e
commit 46109f5c4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 49 deletions

View file

@ -1,13 +1,17 @@
package com.lagradost.cloudstream3.movieproviders package com.lagradost.cloudstream3.movieproviders
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.extractors.Evoload
import com.lagradost.cloudstream3.utils.extractorApis import com.lagradost.cloudstream3.extractors.FEmbed
import com.lagradost.cloudstream3.extractors.StreamTape
import com.lagradost.cloudstream3.utils.*
import java.util.* import java.util.*
class CinecalidadProvider:MainAPI() { class CinecalidadProvider:MainAPI() {
override val mainUrl = "https://cinecalidad.lol" override val mainUrl: String
override val name = "Cinecalidad" get() = "https://cinecalidad.lol"
override val name: String
get() = "Cinecalidad"
override val lang = "es" override val lang = "es"
override val hasMainPage = true override val hasMainPage = true
override val hasChromecastSupport = true override val hasChromecastSupport = true
@ -16,31 +20,16 @@ class CinecalidadProvider : MainAPI() {
TvType.Movie, TvType.Movie,
TvType.TvSeries, TvType.TvSeries,
) )
override val vpnStatus = VPNStatus.MightBeNeeded //Due to evoload sometimes not loading
override suspend fun getMainPage(): HomePageResponse { override suspend fun getMainPage(): HomePageResponse {
val items = ArrayList<HomePageList>() val items = ArrayList<HomePageList>()
val urls = listOf( val urls = listOf(
Pair("$mainUrl/ver-serie/", "Series"),
Pair("$mainUrl/", "Peliculas"), Pair("$mainUrl/", "Peliculas"),
Pair("$mainUrl/genero-de-la-pelicula/peliculas-en-calidad-4k/", "4K UHD"), Pair("$mainUrl/genero-de-la-pelicula/peliculas-en-calidad-4k/", "4K UHD"),
) )
items.add(
HomePageList(
"Series",
app.get("$mainUrl/ver-serie/").document.select(".item.tvshows").map {
val title = it.selectFirst("div.in_title").text()
TvSeriesSearchResponse(
title,
it.selectFirst("a").attr("href"),
this.name,
TvType.TvSeries,
it.selectFirst(".poster.custom img").attr("data-src"),
null,
null,
)
})
)
for (i in urls) { for (i in urls) {
try { try {
val soup = app.get(i.first).document val soup = app.get(i.first).document
@ -69,7 +58,7 @@ class CinecalidadProvider : MainAPI() {
} }
override suspend fun search(query: String): List<SearchResponse> { override suspend fun search(query: String): List<SearchResponse> {
val url = "$mainUrl/buscar/?s=${query}" val url = "$mainUrl/?s=${query}"
val document = app.get(url).document val document = app.get(url).document
return document.select("article").map { return document.select("article").map {
@ -106,13 +95,12 @@ class CinecalidadProvider : MainAPI() {
val soup = app.get(url, timeout = 120).document val soup = app.get(url, timeout = 120).document
val title = soup.selectFirst(".single_left h1").text() val title = soup.selectFirst(".single_left h1").text()
val description = val description = soup.selectFirst("div.single_left table tbody tr td p")?.text()?.trim()
soup.selectFirst(".single_left > table:nth-child(3) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(2) > p")
?.text()?.trim()
val poster: String? = soup.selectFirst(".alignnone").attr("data-src") val poster: String? = soup.selectFirst(".alignnone").attr("data-src")
val episodes = soup.select("div.se-c div.se-a ul.episodios li").map { li -> val episodes = soup.select("div.se-c div.se-a ul.episodios li").map { li ->
val href = li.selectFirst("a").attr("href") val href = li.selectFirst("a").attr("href")
val epThumb = li.selectFirst("div.imagen img").attr("data-src") val epThumb = li.selectFirst("div.imagen img").attr("data-src") ?: li.selectFirst("div.imagen img").attr("src")
val name = li.selectFirst(".episodiotitle a").text() val name = li.selectFirst(".episodiotitle a").text()
TvSeriesEpisode( TvSeriesEpisode(
name, name,
@ -122,8 +110,7 @@ class CinecalidadProvider : MainAPI() {
epThumb epThumb
) )
} }
return when (val tvType = return when (val tvType = if (url.contains("/ver-pelicula/")) TvType.Movie else TvType.TvSeries) {
if (url.contains("/ver-pelicula/")) TvType.Movie else TvType.TvSeries) {
TvType.TvSeries -> { TvType.TvSeries -> {
TvSeriesLoadResponse( TvSeriesLoadResponse(
title, title,
@ -152,33 +139,32 @@ class CinecalidadProvider : MainAPI() {
} }
} }
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 {
app.get(data).document.select(".ajax_mode .dooplay_player_option").forEach { app.get(data).document.select(".dooplay_player_option").apmap {
val movieID = it.attr("data-post") val url = it.attr("data-option")
val serverID = it.attr("data-nume") if (url.startsWith("https://evoload.io")) {
val url = "$mainUrl/wp-json/dooplayer/v2/$movieID/movie/$serverID" val extractor = Evoload()
val urlserver = app.get(url).text extractor.getSafeUrl(url)?.forEach { link ->
val serverRegex = Regex("(https:.*?\\\")") callback.invoke(link)
val videos = serverRegex.findAll(urlserver).map { }
it.value.replace("\\/", "/").replace("\"", "") } else {
}.toList() loadExtractor(url, mainUrl, callback)
val serversRegex =
Regex("(https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&\\/\\/=]*))")
val links = serversRegex.findAll(videos.toString()).map { it.value }.toList()
for (link in links) {
for (extractor in extractorApis) {
if (link.startsWith(extractor.mainUrl)) {
extractor.getSafeUrl(link, data)?.forEach {
callback(it)
} }
} }
if ((app.get(data).text.contains("en castellano"))) app.get("$data?ref=es").document.select(".dooplay_player_option").apmap {
val url = it.attr("data-option")
if (url.startsWith("https://evoload.io")) {
val extractor = Evoload()
extractor.getSafeUrl(url)?.forEach { link ->
callback.invoke(link)
} }
} else {
loadExtractor(url, mainUrl, callback)
} }
} }
return true return true

View file

@ -16,6 +16,8 @@ class PeliSmartProvider: MainAPI() {
TvType.Movie, TvType.Movie,
TvType.TvSeries, TvType.TvSeries,
) )
override val vpnStatus = VPNStatus.MightBeNeeded //Due to evoload sometimes not loading
override suspend fun getMainPage(): HomePageResponse { override suspend fun getMainPage(): HomePageResponse {
val items = ArrayList<HomePageList>() val items = ArrayList<HomePageList>()
val urls = listOf( val urls = listOf(