From a975e5cf4b0119254dad12081f474201a02d34eb Mon Sep 17 00:00:00 2001 From: Zaw <42999156+ImZaw@users.noreply.github.com> Date: Mon, 11 Apr 2022 17:16:22 +0300 Subject: [PATCH] Fix egybest (#939) * fixes, added quality to SearchResponse * more qualities --- .../java/com/lagradost/cloudstream3/MainAPI.kt | 6 ++++++ .../movieproviders/EgyBestProvider.kt | 17 +++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt b/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt index c5c31c60..72091157 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/MainAPI.kt @@ -587,17 +587,22 @@ fun getQualityFromString(string: String?): SearchQuality? { "cam" -> SearchQuality.Cam "camrip" -> SearchQuality.CamRip "hdcam" -> SearchQuality.HdCam + "hdtc" -> SearchQuality.HdCam + "hdts" -> SearchQuality.HdCam "highquality" -> SearchQuality.HQ "hq" -> SearchQuality.HQ "highdefinition" -> SearchQuality.HD "hdrip" -> SearchQuality.HD "hd" -> SearchQuality.HD + "hdtv" -> SearchQuality.HD "rip" -> SearchQuality.CamRip "telecine" -> SearchQuality.Telecine "tc" -> SearchQuality.Telecine "telesync" -> SearchQuality.Telesync "ts" -> SearchQuality.Telesync "dvd" -> SearchQuality.DVD + "dvdrip" -> SearchQuality.DVD + "dvdscr" -> SearchQuality.DVD "blueray" -> SearchQuality.BlueRay "bluray" -> SearchQuality.BlueRay "br" -> SearchQuality.BlueRay @@ -609,6 +614,7 @@ fun getQualityFromString(string: String?): SearchQuality? { "wp" -> SearchQuality.WorkPrint "workprint" -> SearchQuality.WorkPrint "webrip" -> SearchQuality.WebRip + "webdl" -> SearchQuality.WebRip "web" -> SearchQuality.WebRip "hdr" -> SearchQuality.HDR "sdr" -> SearchQuality.SDR diff --git a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/EgyBestProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/EgyBestProvider.kt index 2130eaf9..fb98857b 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/EgyBestProvider.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/EgyBestProvider.kt @@ -8,7 +8,7 @@ import org.jsoup.nodes.Element class EgyBestProvider : MainAPI() { override val lang = "ar" - override var mainUrl = "https://egy.best" + override var mainUrl = "https://www.egy.best" override var name = "EgyBest" override val usesWebView = false override val hasMainPage = true @@ -26,6 +26,7 @@ class EgyBestProvider : MainAPI() { val isMovie = Regex(".*/movie/.*|.*/masrahiya/.*").matches(url) val tvType = if (isMovie) TvType.Movie else TvType.TvSeries title = if (year !== null) title else title.split(" (")[0].trim() + val quality = select("span.ribbon span").text().replace("-", "") // If you need to differentiate use the url. return MovieSearchResponse( title, @@ -35,18 +36,22 @@ class EgyBestProvider : MainAPI() { posterUrl, year, null, + quality = getQualityFromString(quality) ) } override suspend fun getMainPage(): HomePageResponse { // url, title val doc = app.get(mainUrl).document - val pages = doc.select("#mainLoad div.mbox").apmap { + val pages = arrayListOf() + doc.select("#mainLoad div.mbox").apmap { val name = it.select(".bdb.pda > strong").text() - val list = it.select(".movie").mapNotNull { element -> - element.toSearchResponse() + if (it.select(".movie").first().attr("href").contains("season-(.....)|ep-(.....)".toRegex())) return@apmap + val list = arrayListOf() + it.select(".movie").map { element -> + list.add(element.toSearchResponse()!!) } - HomePageList(name, list) + pages.add(HomePageList(name, list)) } return HomePageResponse(pages) } @@ -72,7 +77,7 @@ class EgyBestProvider : MainAPI() { val isMovie = Regex(".*/movie/.*|.*/masrahiya/.*").matches(url) val posterUrl = doc.select("div.movie_img a img")?.attr("src") val year = doc.select("div.movie_title h1 a")?.text()?.toIntOrNull() - val title = doc.select("div.movie_title h1 span[itemprop=\"name\"]").text() + val title = doc.select("div.movie_title h1 span").text() val synopsis = doc.select("div.mbox").firstOrNull { it.text().contains("القصة")