Fix egybest (#939)

* fixes, added quality to SearchResponse

* more qualities
This commit is contained in:
Zaw 2022-04-11 17:16:22 +03:00 committed by GitHub
parent d4ddab83e4
commit a975e5cf4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 6 deletions

View file

@ -587,17 +587,22 @@ fun getQualityFromString(string: String?): SearchQuality? {
"cam" -> SearchQuality.Cam "cam" -> SearchQuality.Cam
"camrip" -> SearchQuality.CamRip "camrip" -> SearchQuality.CamRip
"hdcam" -> SearchQuality.HdCam "hdcam" -> SearchQuality.HdCam
"hdtc" -> SearchQuality.HdCam
"hdts" -> SearchQuality.HdCam
"highquality" -> SearchQuality.HQ "highquality" -> SearchQuality.HQ
"hq" -> SearchQuality.HQ "hq" -> SearchQuality.HQ
"highdefinition" -> SearchQuality.HD "highdefinition" -> SearchQuality.HD
"hdrip" -> SearchQuality.HD "hdrip" -> SearchQuality.HD
"hd" -> SearchQuality.HD "hd" -> SearchQuality.HD
"hdtv" -> SearchQuality.HD
"rip" -> SearchQuality.CamRip "rip" -> SearchQuality.CamRip
"telecine" -> SearchQuality.Telecine "telecine" -> SearchQuality.Telecine
"tc" -> SearchQuality.Telecine "tc" -> SearchQuality.Telecine
"telesync" -> SearchQuality.Telesync "telesync" -> SearchQuality.Telesync
"ts" -> SearchQuality.Telesync "ts" -> SearchQuality.Telesync
"dvd" -> SearchQuality.DVD "dvd" -> SearchQuality.DVD
"dvdrip" -> SearchQuality.DVD
"dvdscr" -> SearchQuality.DVD
"blueray" -> SearchQuality.BlueRay "blueray" -> SearchQuality.BlueRay
"bluray" -> SearchQuality.BlueRay "bluray" -> SearchQuality.BlueRay
"br" -> SearchQuality.BlueRay "br" -> SearchQuality.BlueRay
@ -609,6 +614,7 @@ fun getQualityFromString(string: String?): SearchQuality? {
"wp" -> SearchQuality.WorkPrint "wp" -> SearchQuality.WorkPrint
"workprint" -> SearchQuality.WorkPrint "workprint" -> SearchQuality.WorkPrint
"webrip" -> SearchQuality.WebRip "webrip" -> SearchQuality.WebRip
"webdl" -> SearchQuality.WebRip
"web" -> SearchQuality.WebRip "web" -> SearchQuality.WebRip
"hdr" -> SearchQuality.HDR "hdr" -> SearchQuality.HDR
"sdr" -> SearchQuality.SDR "sdr" -> SearchQuality.SDR

View file

@ -8,7 +8,7 @@ import org.jsoup.nodes.Element
class EgyBestProvider : MainAPI() { class EgyBestProvider : MainAPI() {
override val lang = "ar" override val lang = "ar"
override var mainUrl = "https://egy.best" override var mainUrl = "https://www.egy.best"
override var name = "EgyBest" override var name = "EgyBest"
override val usesWebView = false override val usesWebView = false
override val hasMainPage = true override val hasMainPage = true
@ -26,6 +26,7 @@ class EgyBestProvider : MainAPI() {
val isMovie = Regex(".*/movie/.*|.*/masrahiya/.*").matches(url) val isMovie = Regex(".*/movie/.*|.*/masrahiya/.*").matches(url)
val tvType = if (isMovie) TvType.Movie else TvType.TvSeries val tvType = if (isMovie) TvType.Movie else TvType.TvSeries
title = if (year !== null) title else title.split(" (")[0].trim() 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. // If you need to differentiate use the url.
return MovieSearchResponse( return MovieSearchResponse(
title, title,
@ -35,18 +36,22 @@ class EgyBestProvider : MainAPI() {
posterUrl, posterUrl,
year, year,
null, null,
quality = getQualityFromString(quality)
) )
} }
override suspend fun getMainPage(): HomePageResponse { override suspend fun getMainPage(): HomePageResponse {
// url, title // url, title
val doc = app.get(mainUrl).document val doc = app.get(mainUrl).document
val pages = doc.select("#mainLoad div.mbox").apmap { val pages = arrayListOf<HomePageList>()
doc.select("#mainLoad div.mbox").apmap {
val name = it.select(".bdb.pda > strong").text() val name = it.select(".bdb.pda > strong").text()
val list = it.select(".movie").mapNotNull { element -> if (it.select(".movie").first().attr("href").contains("season-(.....)|ep-(.....)".toRegex())) return@apmap
element.toSearchResponse() val list = arrayListOf<SearchResponse>()
it.select(".movie").map { element ->
list.add(element.toSearchResponse()!!)
} }
HomePageList(name, list) pages.add(HomePageList(name, list))
} }
return HomePageResponse(pages) return HomePageResponse(pages)
} }
@ -72,7 +77,7 @@ class EgyBestProvider : MainAPI() {
val isMovie = Regex(".*/movie/.*|.*/masrahiya/.*").matches(url) val isMovie = Regex(".*/movie/.*|.*/masrahiya/.*").matches(url)
val posterUrl = doc.select("div.movie_img a img")?.attr("src") val posterUrl = doc.select("div.movie_img a img")?.attr("src")
val year = doc.select("div.movie_title h1 a")?.text()?.toIntOrNull() 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 { val synopsis = doc.select("div.mbox").firstOrNull {
it.text().contains("القصة") it.text().contains("القصة")