From 8bc92ab8e2c42d69139150979325b9dc87da10cb Mon Sep 17 00:00:00 2001 From: Lazycoder Date: Thu, 8 Sep 2022 17:14:35 +0200 Subject: [PATCH] some fixes -added more categories -added qualities -added rating -fixed tags --- .../kotlin/com/fushaar/FushaarProvider.kt | 69 +++++++++++-------- 1 file changed, 39 insertions(+), 30 deletions(-) diff --git a/FushaarProvider/src/main/kotlin/com/fushaar/FushaarProvider.kt b/FushaarProvider/src/main/kotlin/com/fushaar/FushaarProvider.kt index 0948367..cfdef97 100644 --- a/FushaarProvider/src/main/kotlin/com/fushaar/FushaarProvider.kt +++ b/FushaarProvider/src/main/kotlin/com/fushaar/FushaarProvider.kt @@ -39,25 +39,30 @@ class Fushaar : MainAPI() { } override val mainPage = mainPageOf( - "$mainUrl/page/" to "Movies", - "$mainUrl/gerne/action/page/" to "Action", - "$mainUrl/gerne/adventure/page/" to "Adventure", - "$mainUrl/gerne/animation/page/" to "Animation", - "$mainUrl/gerne/biography/page/" to "Biography", - "$mainUrl/gerne/comedy/page/" to "Comedy", - "$mainUrl/gerne/crime/page/" to "Crime", - "$mainUrl/gerne/documentary/page/" to "Documentary", - "$mainUrl/gerne/drama/page/" to "Drama", - "$mainUrl/gerne/family/page/" to "Family", - "$mainUrl/gerne/herror/page/" to "Herror", - "$mainUrl/gerne/history/page/" to "History", - "$mainUrl/gerne/music/page/" to "Music", - "$mainUrl/gerne/mystery/page/" to "Mystery", - "$mainUrl/gerne/romance/page/" to "Romance", - "$mainUrl/gerne/sci-fi/page/" to "Sci-fi", - "$mainUrl/gerne/sport/page/" to "Sport", - "$mainUrl/gerne/thriller/page/" to "Thriller", - ) + "$mainUrl/page/" to "Movies|أفلام", + "$mainUrl/gerne/action/page/" to "Action|إثارة", + "$mainUrl/gerne/adventure/page/" to "Adventure|مغامرة", + "$mainUrl/gerne/animation/page/" to "Animation|أنيمايشن", + "$mainUrl/gerne/biography/page/" to "Biography|سيرة", + "$mainUrl/gerne/comedy/page/" to "Comedy|كوميديا", + "$mainUrl/gerne/crime/page/" to "Crime|جريمة", + "$mainUrl/gerne/documentary/page/" to "Documentary|وثائقي", + "$mainUrl/gerne/drama/page/" to "Drama|دراما", + "$mainUrl/gerne/family/page/" to "Family|عائلي", + "$mainUrl/gerne/fantasy/page/" to "Fantasy|فنتازيا", + "$mainUrl/gerne/herror/page/" to "Herror|رعب", + "$mainUrl/gerne/history/page/" to "History|تاريخي", + "$mainUrl/gerne/music/page/" to "Music|موسيقى", + "$mainUrl/gerne/musical/page/" to "Musical|موسيقي", + "$mainUrl/gerne/mystery/page/" to "Mystery|غموض", + "$mainUrl/gerne/romance/page/" to "Romance|رومنسي", + "$mainUrl/gerne/sci-fi/page/" to "Sci-fi|خيال علمي", + "$mainUrl/gerne/short/page/" to "Short|قصير", + "$mainUrl/gerne/sport/page/" to "Sport|رياضة", + "$mainUrl/gerne/thriller/page/" to "Thriller|روائي", + "$mainUrl/gerne/war/page/" to "War|حرب", + "$mainUrl/gerne/western/page/" to "Western|غربي", + ) override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse { val doc = app.get(request.data + page).document @@ -68,7 +73,7 @@ class Fushaar : MainAPI() { } override suspend fun search(query: String): List { - val q = query.replace(" ", "%20") + val q = query.replace(" ", "+") return app.get("$mainUrl/?s=$q").document.select("article.poster").mapNotNull { it.toSearchResponse() } @@ -82,9 +87,12 @@ class Fushaar : MainAPI() { val title = doc.select("header h1").text()+"\n"+doc.select("header h2").text() val synopsis = doc.select("div.postz").text() val trailer = doc.select("div.rll-youtube-player iframe").attr("src") - val tags = doc.select("div.z-info li").map { it.text() } - - + val tags = doc.select("li.iifo").map { it.select("span.z-s-i").text()+" "+it.select("h8").text() } + val rating = doc.select("body > div.new-info.hide-mobile > div > div.z-imdb > div").text()?.toRatingInt() + val recommendations = doc.select("article.poster").mapNotNull { element -> + element.toSearchResponse() + } + return newMovieLoadResponse( title, url, @@ -95,6 +103,8 @@ class Fushaar : MainAPI() { this.year = year this.tags = tags this.plot = synopsis + this.rating = rating + this.recommendations = recommendations addTrailer(trailer) } } @@ -107,18 +117,17 @@ class Fushaar : MainAPI() { callback: (ExtractorLink) -> Unit ): Boolean { app.get(data).document - .select("#fancyboxID-8 > script").map { + .select("#fancyboxID-download > center > a:nth-child(n+19),#fancyboxID-1 > center > a:nth-child(n+16)").map { callback.invoke( ExtractorLink( source = this.name, name = name, - url = it.html().substring(252,384), + url = it.attr("href"), referer = this.mainUrl, - quality = Qualities.Unknown.value, - isM3u8 = true - ) + quality = it.text().getIntFromText() ?: Qualities.Unknown.value, ) - } -return true + ) + } + return true } }