From d807aa4ba4015a17237ed402b1a629fdb0619ef5 Mon Sep 17 00:00:00 2001 From: Lazycoder Date: Sun, 21 Aug 2022 04:41:59 +0200 Subject: [PATCH 1/5] Add files via upload --- FushaarProvider/build.gradle.kts | 12 ++ FushaarProvider/src/main/AndroidManifest.xml | 2 + .../main/kotlin/com/fushaar/FushaarPlugin.kt | 11 ++ .../kotlin/com/fushaar/FushaarProvider.kt | 135 ++++++++++++++++++ 4 files changed, 160 insertions(+) create mode 100644 FushaarProvider/build.gradle.kts create mode 100644 FushaarProvider/src/main/AndroidManifest.xml create mode 100644 FushaarProvider/src/main/kotlin/com/fushaar/FushaarPlugin.kt create mode 100644 FushaarProvider/src/main/kotlin/com/fushaar/FushaarProvider.kt diff --git a/FushaarProvider/build.gradle.kts b/FushaarProvider/build.gradle.kts new file mode 100644 index 0000000..6e33013 --- /dev/null +++ b/FushaarProvider/build.gradle.kts @@ -0,0 +1,12 @@ +version = 1 + +cloudstream { + description = "" + authors = listOf( "ImZaw" ) + + status = 1 + + tvTypes = listOf( "Movie") + + iconUrl = "https://www.google.com/s2/favicons?domain=www.fushaar.com&sz=%size%" +} \ No newline at end of file diff --git a/FushaarProvider/src/main/AndroidManifest.xml b/FushaarProvider/src/main/AndroidManifest.xml new file mode 100644 index 0000000..63e74f0 --- /dev/null +++ b/FushaarProvider/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/FushaarProvider/src/main/kotlin/com/fushaar/FushaarPlugin.kt b/FushaarProvider/src/main/kotlin/com/fushaar/FushaarPlugin.kt new file mode 100644 index 0000000..909ac2a --- /dev/null +++ b/FushaarProvider/src/main/kotlin/com/fushaar/FushaarPlugin.kt @@ -0,0 +1,11 @@ +package com.fushaar +import com.lagradost.cloudstream3.plugins.CloudstreamPlugin +import com.lagradost.cloudstream3.plugins.Plugin +import android.content.Context + +@CloudstreamPlugin +class FushaarPlugin: Plugin() { + override fun load(context: Context) { + registerMainAPI(Fushaar()) + } +} \ No newline at end of file diff --git a/FushaarProvider/src/main/kotlin/com/fushaar/FushaarProvider.kt b/FushaarProvider/src/main/kotlin/com/fushaar/FushaarProvider.kt new file mode 100644 index 0000000..3e864ab --- /dev/null +++ b/FushaarProvider/src/main/kotlin/com/fushaar/FushaarProvider.kt @@ -0,0 +1,135 @@ +package com.lagradost.cloudstream3.movieproviders + +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer +import com.lagradost.cloudstream3.utils.AppUtils +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.Qualities +import com.lagradost.cloudstream3.utils.getQualityFromName +import org.jsoup.nodes.Element + +class FushaarProvider : MainAPI() { + override var lang = "ar" + override var mainUrl = "https://www.fushaar.com" + override var name = "Fushaar" + override val usesWebView = false + override val hasMainPage = true + override val supportedTypes = setOf(TvType.Movie) + + + private fun String.getIntFromText(): Int? { + return Regex("""\d+""").find(this)?.groupValues?.firstOrNull()?.toIntOrNull() + } + + private fun Element.toSearchResponse(): SearchResponse? { + val url = select("article.poster") + val posterUrl = select("img").attr("data-lazy-src") + val year = select("ul.labels li.year").text()?.getIntFromText() + var quality = select("div").first()?.attr("class")?.replace("hdd","hd")?.replace("caam","cam") + val title = select("div.info h3").text()+"\n"+select("div.info h4").text() + + return MovieSearchResponse( + title, + url.select("a").attr("href"), + this@FushaarProvider.name, + TvType.Movie, + posterUrl.also{print("posterurl :"+it)}, + year, + null, + quality = getQualityFromString(quality), + ) + } + + override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse { + // Title, Url + val moviesUrl = listOf( + "Movies" to "$mainUrl/page/" + (0..25).random(), + "Herror" to "$mainUrl/gerne/herror", + "Thriller" to "$mainUrl/gerne/thriller", + "Action" to "$mainUrl/gerne/action", + "Animation" to "$mainUrl/gerne/animation", + "Comedy" to "$mainUrl/gerne/comedy", + "Sci-fi" to "$mainUrl/gerne/sci-fi", + "Crime" to "$mainUrl/gerne/crime", + "Drama" to "$mainUrl/gerne/drama", + "Adventure" to "$mainUrl/gerne/adventure", + "Biography" to "$mainUrl/gerne/biography", + "Music" to "$mainUrl/gerne/music", + "Sport" to "$mainUrl/gerne/sport", + "Documentary" to "$mainUrl/gerne/documentary", + "History" to "$mainUrl/gerne/history", + "Family" to "$mainUrl/gerne/family", + "Romance" to "$mainUrl/gerne/romance", + "Mystery" to "$mainUrl/gerne/mystery" + ) + val pages = moviesUrl.apmap { + val doc = app.get(it.second).document + val list = doc.select("article.poster").mapNotNull { element -> + element.toSearchResponse() + } + HomePageList(it.first, list) + }.sortedBy { it.name } + return HomePageResponse(pages) + } + + override suspend fun search(query: String): List { + val q = query.replace(" ", "%20") + val result = arrayListOf() + listOf( + "$mainUrl/?s=$q", + ).apmap { url -> + val d = app.get(url).document + d.select("article.poster").mapNotNull { + it.toSearchResponse()?.let { it1 -> result.add(it1) } + } + } + return result.distinct().sortedBy { it.name } + } + + override suspend fun load(url: String): LoadResponse { + var doc = app.get(url).document + val posterUrl = doc.select("figure.poster noscript img").attr("src") + val year = doc.select("header span.yearz").text()?.getIntFromText() + 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() } + + + return newMovieLoadResponse( + title, + url, + TvType.Movie, + "$url" + ) { + this.posterUrl = posterUrl.also{print("posterurl2 :"+it)} + this.year = year + this.tags = tags + this.plot = synopsis + addTrailer(trailer) + } + } + + + override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + app.get(data).document + .select("#fancyboxID-8 > script").map { + callback.invoke( + ExtractorLink( + source = this.name, + name = name, + url = it.html().substring(252,384), + referer = this.mainUrl, + quality = 1080, + isM3u8 = true + ) + ) + } +return true + } +} \ No newline at end of file From 08dc4cc18e2d8d683c516795b253fffd52e2a194 Mon Sep 17 00:00:00 2001 From: Lazycoder Date: Sun, 21 Aug 2022 21:27:04 +0200 Subject: [PATCH 2/5] Update build.gradle.kts --- FushaarProvider/build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FushaarProvider/build.gradle.kts b/FushaarProvider/build.gradle.kts index 6e33013..5956ba6 100644 --- a/FushaarProvider/build.gradle.kts +++ b/FushaarProvider/build.gradle.kts @@ -2,11 +2,11 @@ version = 1 cloudstream { description = "" - authors = listOf( "ImZaw" ) + authors = listOf( "Spoonge" ) status = 1 tvTypes = listOf( "Movie") iconUrl = "https://www.google.com/s2/favicons?domain=www.fushaar.com&sz=%size%" -} \ No newline at end of file +} From 13c7e68057bc7ae3ec419b0341240e4ff7ea9f94 Mon Sep 17 00:00:00 2001 From: Lazycoder Date: Sun, 21 Aug 2022 21:29:32 +0200 Subject: [PATCH 3/5] Update build.gradle.kts --- FushaarProvider/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FushaarProvider/build.gradle.kts b/FushaarProvider/build.gradle.kts index 5956ba6..df7c009 100644 --- a/FushaarProvider/build.gradle.kts +++ b/FushaarProvider/build.gradle.kts @@ -3,7 +3,7 @@ version = 1 cloudstream { description = "" authors = listOf( "Spoonge" ) - + language = "ar" status = 1 tvTypes = listOf( "Movie") From 3bb52f67d650627e3b9be309597199308fbf0a03 Mon Sep 17 00:00:00 2001 From: Lazycoder Date: Mon, 22 Aug 2022 19:57:15 +0200 Subject: [PATCH 4/5] Update FushaarProvider.kt --- .../kotlin/com/fushaar/FushaarProvider.kt | 45 +++++++------------ 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/FushaarProvider/src/main/kotlin/com/fushaar/FushaarProvider.kt b/FushaarProvider/src/main/kotlin/com/fushaar/FushaarProvider.kt index 3e864ab..8f7c30d 100644 --- a/FushaarProvider/src/main/kotlin/com/fushaar/FushaarProvider.kt +++ b/FushaarProvider/src/main/kotlin/com/fushaar/FushaarProvider.kt @@ -2,10 +2,8 @@ package com.lagradost.cloudstream3.movieproviders import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer -import com.lagradost.cloudstream3.utils.AppUtils import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.Qualities -import com.lagradost.cloudstream3.utils.getQualityFromName import org.jsoup.nodes.Element class FushaarProvider : MainAPI() { @@ -33,17 +31,15 @@ class FushaarProvider : MainAPI() { url.select("a").attr("href"), this@FushaarProvider.name, TvType.Movie, - posterUrl.also{print("posterurl :"+it)}, + posterUrl, year, null, quality = getQualityFromString(quality), ) } - override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse { - // Title, Url - val moviesUrl = listOf( - "Movies" to "$mainUrl/page/" + (0..25).random(), + override val mainPage = mainPageOf( + "Movies" to "$mainUrl" + (0..25).random(), "Herror" to "$mainUrl/gerne/herror", "Thriller" to "$mainUrl/gerne/thriller", "Action" to "$mainUrl/gerne/action", @@ -62,30 +58,23 @@ class FushaarProvider : MainAPI() { "Romance" to "$mainUrl/gerne/romance", "Mystery" to "$mainUrl/gerne/mystery" ) - val pages = moviesUrl.apmap { - val doc = app.get(it.second).document - val list = doc.select("article.poster").mapNotNull { element -> - element.toSearchResponse() - } - HomePageList(it.first, list) - }.sortedBy { it.name } - return HomePageResponse(pages) + + override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse { + val doc = app.get(request.data + "/page/$page/").document + val list = doc.select("article.poster").mapNotNull { element -> + element.toSearchResponse() + } + return newHomePageResponse(request.name, list) } override suspend fun search(query: String): List { val q = query.replace(" ", "%20") - val result = arrayListOf() - listOf( - "$mainUrl/?s=$q", - ).apmap { url -> - val d = app.get(url).document - d.select("article.poster").mapNotNull { - it.toSearchResponse()?.let { it1 -> result.add(it1) } - } + return app.get("$mainUrl/?s=$q").document.select("article.poster").mapNotNull { + it.toSearchResponse() } - return result.distinct().sortedBy { it.name } } + override suspend fun load(url: String): LoadResponse { var doc = app.get(url).document val posterUrl = doc.select("figure.poster noscript img").attr("src") @@ -100,9 +89,9 @@ class FushaarProvider : MainAPI() { title, url, TvType.Movie, - "$url" + url ) { - this.posterUrl = posterUrl.also{print("posterurl2 :"+it)} + this.posterUrl = posterUrl this.year = year this.tags = tags this.plot = synopsis @@ -125,11 +114,11 @@ class FushaarProvider : MainAPI() { name = name, url = it.html().substring(252,384), referer = this.mainUrl, - quality = 1080, + quality = Qualities.Unknown.value, isM3u8 = true ) ) } return true } -} \ No newline at end of file +}