From ea7dfdad5a5913fff41e09ae37c2ba05251ff4f3 Mon Sep 17 00:00:00 2001 From: Zaw <42999156+ImZaw@users.noreply.github.com> Date: Mon, 25 Apr 2022 00:26:09 +0300 Subject: [PATCH] Egybest fixes (#993) fix for media links fix for episodes table new layout --- .../movieproviders/EgyBestProvider.kt | 55 ++++++++++++------- 1 file changed, 35 insertions(+), 20 deletions(-) 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 9d56f70f..41266a81 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/EgyBestProvider.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/EgyBestProvider.kt @@ -44,7 +44,7 @@ class EgyBestProvider : MainAPI() { // url, title val doc = app.get(mainUrl).document val pages = arrayListOf() - doc.select("#mainLoad div.mbox").apmap { + doc.select("#mainLoad div.mbox").apmap { val name = it.select(".bdb.pda > strong").text() if (it.select(".movie").first().attr("href").contains("season-(.....)|ep-(.....)".toRegex())) return@apmap val list = arrayListOf() @@ -120,16 +120,31 @@ class EgyBestProvider : MainAPI() { }.apmap { val d = app.get(it).document val season = Regex("season-(.....)").find(it)?.groupValues?.getOrNull(1)?.getIntFromText() - d.select("#mainLoad > div:nth-child(3) > div.movies_small a").map { eit -> - val ep = Regex("ep-(.....)").find(eit.attr("href"))?.groupValues?.getOrNull(1)?.getIntFromText() - episodes.add( - Episode( - eit.attr("href"), - eit.select("span.title").text(), - season, - ep, + if(d.select("tr.published").isNotEmpty()) { + d.select("tr.published").map { element -> + val ep = Regex("ep-(.....)").find(element.select(".ep_title a").attr("href"))?.groupValues?.getOrNull(1)?.getIntFromText() + episodes.add( + Episode( + element.select(".ep_title a").attr("href"), + name = element.select("td.ep_title").html().replace(".*|".toRegex(), ""), + season, + ep, + rating = element.select("td.tam:not(.date, .ep_len)").text().getIntFromText() + ) ) - ) + } + } else { + d.select("#mainLoad > div:nth-child(3) > div.movies_small a").map { eit -> + val ep = Regex("ep-(.....)").find(eit.attr("href"))?.groupValues?.getOrNull(1)?.getIntFromText() + episodes.add( + Episode( + eit.attr("href"), + eit.select("span.title").text(), + season, + ep, + ) + ) + } } } newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes.distinct().sortedBy { it.episode }) { @@ -151,21 +166,21 @@ class EgyBestProvider : MainAPI() { subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit ): Boolean { - val requestJSON = app.get("https://zawmedia-api.herokuapp.com/egybest?url=$data").text + val requestJSON = app.get("https://api.zr5.repl.co/egybest?url=$data").text val jsonArray = parseJson>(requestJSON) for (i in jsonArray) { val quality = i.quality val link = i.link - callback.invoke( - ExtractorLink( - this.name, - this.name + " ${quality}p", - link, - this.mainUrl, - 2, - true - ) + callback.invoke( + ExtractorLink( + this.name, + this.name, + link, + this.mainUrl, + quality!!, + true ) + ) } return true }