From 458aac3df7d46e958693e1f787118427a9a995e9 Mon Sep 17 00:00:00 2001 From: Spoonge Date: Sat, 28 Jan 2023 10:19:51 +0100 Subject: [PATCH] update providers (#3) * added more extractors and fixed movizland * update movizland fushaar mycima shahed4u --- FushaarProvider/build.gradle.kts | 2 +- .../kotlin/com/fushaar/FushaarProvider.kt | 19 +- MovizlandProvider/build.gradle.kts | 6 +- .../src/main/kotlin/com/movizland/Govad.kt | 53 ++++ .../src/main/kotlin/com/movizland/JWPlayer.kt | 59 ++++ .../kotlin/com/movizland/MovizlandPlugin.kt | 4 + .../com/movizland/MovizlandProvider copy.kt | 277 ++++++++++++++++++ .../kotlin/com/movizland/MovizlandProvider.kt | 200 ++++++++----- MyCimaProvider/build.gradle.kts | 2 +- .../main/kotlin/com/mycima/MyCimaPlugin.kt | 1 + .../src/main/kotlin/com/mycima/myvid.kt | 32 ++ Shahid4uProvider/build.gradle.kts | 2 +- .../kotlin/com/shahid4u/JWPlayerExtractor.kt | 4 - .../kotlin/com/shahid4u/Shahid4uProvider.kt | 2 +- .../src/main/kotlin/com/shahid4u/gostream.kt | 33 +++ .../src/main/kotlin/com/shahid4u/vidhd.kt | 46 +++ 16 files changed, 651 insertions(+), 91 deletions(-) create mode 100644 MovizlandProvider/src/main/kotlin/com/movizland/Govad.kt create mode 100644 MovizlandProvider/src/main/kotlin/com/movizland/JWPlayer.kt create mode 100644 MovizlandProvider/src/main/kotlin/com/movizland/MovizlandProvider copy.kt create mode 100644 MyCimaProvider/src/main/kotlin/com/mycima/myvid.kt create mode 100644 Shahid4uProvider/src/main/kotlin/com/shahid4u/gostream.kt create mode 100644 Shahid4uProvider/src/main/kotlin/com/shahid4u/vidhd.kt diff --git a/FushaarProvider/build.gradle.kts b/FushaarProvider/build.gradle.kts index df7c009..1ac0e33 100644 --- a/FushaarProvider/build.gradle.kts +++ b/FushaarProvider/build.gradle.kts @@ -1,4 +1,4 @@ -version = 1 +version = 2 cloudstream { description = "" diff --git a/FushaarProvider/src/main/kotlin/com/fushaar/FushaarProvider.kt b/FushaarProvider/src/main/kotlin/com/fushaar/FushaarProvider.kt index 0c8747d..73eea8f 100644 --- a/FushaarProvider/src/main/kotlin/com/fushaar/FushaarProvider.kt +++ b/FushaarProvider/src/main/kotlin/com/fushaar/FushaarProvider.kt @@ -26,7 +26,9 @@ class Fushaar : MainAPI() { 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() + val titleOne = select("div.info h3").text() + val titleTwo = select("div.info h4").text() + val title = if(titleOne == titleTwo && titleOne.isNotEmpty()) titleOne else "$titleOne\n$titleTwo" return MovieSearchResponse( title, @@ -53,7 +55,7 @@ class Fushaar : MainAPI() { "$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/history/page/" to "History | تاريخي", "$mainUrl/gerne/music/page/" to "Music | موسيقى", "$mainUrl/gerne/musical/page/" to "Musical | موسيقي", "$mainUrl/gerne/mystery/page/" to "Mystery | غموض", @@ -84,9 +86,12 @@ class Fushaar : MainAPI() { override suspend fun load(url: String): LoadResponse { var doc = app.get(url).document - val posterUrl = doc.select("figure.poster noscript img").attr("src") + val bigPoster = doc.select("""meta[property="og:image"]""").attr("content") + val posterUrl = bigPoster.ifEmpty() { doc.select("figure.poster noscript img").attr("src")} val year = doc.select("header span.yearz").text()?.getIntFromText() - val title = doc.select("header h1").text()+" | "+doc.select("header h2").text() + val ARtitle = doc.select("header h1").text() + val ENtitle = doc.select("header h2").text() + val title = if( ARtitle.isNotEmpty() && ENtitle.isNotEmpty() ) "$ARtitle | $ENtitle" else if(ARtitle == ENtitle) ARtitle else "$ARtitle$ENtitle" val synopsis = doc.select("div.postz").text() val trailer = doc.select("#new-stream > div > div.ytb > a").attr("href") val tags = doc.select("div.zoomInUp a").map{it.text()}//doc.select("li.iifo").map { it.select("span.z-s-i").text()+" "+it.select("h8").text() } @@ -119,13 +124,13 @@ class Fushaar : MainAPI() { callback: (ExtractorLink) -> Unit ): Boolean { val doc = app.get(data).document - var sourceUrl = doc.select("div:nth-child(10) > a").attr("href") + var sourceUrl = doc.select("div:nth-child(3) > div > iframe,div:nth-child(4) > div > iframe").attr("data-lazy-src") loadExtractor(sourceUrl, data, subtitleCallback, callback) doc.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, + name = it.text() ?: name, url = it.attr("href"), referer = this.mainUrl, quality = it.text().getIntFromText() ?: Qualities.Unknown.value, @@ -134,4 +139,4 @@ class Fushaar : MainAPI() { } return true } -} +} \ No newline at end of file diff --git a/MovizlandProvider/build.gradle.kts b/MovizlandProvider/build.gradle.kts index 704f85e..f0e8534 100644 --- a/MovizlandProvider/build.gradle.kts +++ b/MovizlandProvider/build.gradle.kts @@ -1,4 +1,4 @@ -version = 3 +version = 4 cloudstream { description = "Not recommended for series." @@ -8,7 +8,7 @@ cloudstream { status = 1 - tvTypes = listOf( "Movie" ) + tvTypes = listOf( "TvSeries" , "Movie" , "Anime" , "AsianDrama" ) - iconUrl = "https://www.google.com/s2/favicons?domain=movizland.cyou&sz=%size%" + iconUrl = "https://www.google.com/s2/favicons?domain=movizland.online&sz=%size%" } diff --git a/MovizlandProvider/src/main/kotlin/com/movizland/Govad.kt b/MovizlandProvider/src/main/kotlin/com/movizland/Govad.kt new file mode 100644 index 0000000..a26a8c5 --- /dev/null +++ b/MovizlandProvider/src/main/kotlin/com/movizland/Govad.kt @@ -0,0 +1,53 @@ +package com.movizland + +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.app +import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson +import com.lagradost.cloudstream3.utils.ExtractorApi +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.getQualityFromName +import com.lagradost.cloudstream3.utils.Qualities + + +open class Govad : ExtractorApi() { + override val name = "Govad" + override val mainUrl = "https://govad.xyz" + override val requiresReferer = false + + override suspend fun getUrl(url: String, referer: String?): List { + val sources = mutableListOf() + val regcode = """$mainUrl/embed-(\w+)""".toRegex() + val code = regcode.find(url)?.groupValues?.getOrNull(1) + val link = "$mainUrl/$code" + with(app.get(link).document) { + val data = this.select("script").mapNotNull { script -> + if (script.data().contains("sources: [")) { + script.data().substringAfter("sources: [") + .substringBefore("],").replace("file", "\"file\"").replace("label", "\"label\"").replace("type", "\"type\"") + } else { + null + } + } + + tryParseJson>("$data")?.map { + sources.add( + ExtractorLink( + name, + name, + it.file, + referer = url, + quality = getQualityFromName(it.label) ?: Qualities.Unknown.value, + isM3u8 = if(it.file.endsWith(".m3u8")) true else false + ) + ) + } + } + return sources + } + + private data class ResponseSource( + @JsonProperty("file") val file: String, + @JsonProperty("type") val type: String?, + @JsonProperty("label") val label: String? + ) +} diff --git a/MovizlandProvider/src/main/kotlin/com/movizland/JWPlayer.kt b/MovizlandProvider/src/main/kotlin/com/movizland/JWPlayer.kt new file mode 100644 index 0000000..935501f --- /dev/null +++ b/MovizlandProvider/src/main/kotlin/com/movizland/JWPlayer.kt @@ -0,0 +1,59 @@ +package com.movizland + +import com.fasterxml.jackson.annotation.JsonProperty +import com.lagradost.cloudstream3.app +import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson +import com.lagradost.cloudstream3.utils.ExtractorApi +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.getQualityFromName +import com.lagradost.cloudstream3.utils.Qualities + +open class JWPlayer : ExtractorApi() { + override val name = "JWPlayer" + override val mainUrl = "https://www.jwplayer.com" + override val requiresReferer = false + + override suspend fun getUrl(url: String, referer: String?): List? { + val sources = mutableListOf() + with(app.get(url).document) { + val data = this.select("script").mapNotNull { script -> + if (script.data().contains("sources: [")) { + script.data().substringAfter("sources: [") + .substringBefore("],").replace("file", "\"file\"").replace("label", "\"label\"") + } else { + null + } + } + + tryParseJson>("$data")?.map { + sources.add( + ExtractorLink( + name, + name, + it.file, + referer = url, + quality = getQualityFromName(it.label) ?: Qualities.Unknown.value, + isM3u8 = if(it.file.endsWith(".m3u8")) true else false + ) + ) + } + } + return sources + } + + private data class ResponseSource( + @JsonProperty("file") val file: String, + @JsonProperty("type") val type: String?, + @JsonProperty("label") val label: String? + ) + +} + +class Vadbam : JWPlayer() { + override val name = "Vadbam" + override val mainUrl = "https://vadbam.com/" +} +class Vidshar : JWPlayer() { + override val name = "Vidshar" + override val mainUrl = "https://vidshar.org/" +} diff --git a/MovizlandProvider/src/main/kotlin/com/movizland/MovizlandPlugin.kt b/MovizlandProvider/src/main/kotlin/com/movizland/MovizlandPlugin.kt index c576dbc..5dd4bc5 100644 --- a/MovizlandProvider/src/main/kotlin/com/movizland/MovizlandPlugin.kt +++ b/MovizlandProvider/src/main/kotlin/com/movizland/MovizlandPlugin.kt @@ -7,5 +7,9 @@ import android.content.Context class MovizlandPlugin: Plugin() { override fun load(context: Context) { registerMainAPI(Movizland()) + registerExtractorAPI(Govad()) + registerExtractorAPI(Moshahda()) + registerExtractorAPI(Vadbam()) + registerExtractorAPI(Vidshar()) } } \ No newline at end of file diff --git a/MovizlandProvider/src/main/kotlin/com/movizland/MovizlandProvider copy.kt b/MovizlandProvider/src/main/kotlin/com/movizland/MovizlandProvider copy.kt new file mode 100644 index 0000000..7479905 --- /dev/null +++ b/MovizlandProvider/src/main/kotlin/com/movizland/MovizlandProvider copy.kt @@ -0,0 +1,277 @@ +package com.movizland + + +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.Qualities +import com.lagradost.cloudstream3.utils.loadExtractor +import org.jsoup.nodes.Element + +class Movizland : MainAPI() { + override var lang = "ar" + override var mainUrl = "https://movizland.online" + override var name = "Movizland" + override val usesWebView = false + override val hasMainPage = true + override val supportedTypes = setOf(TvType.TvSeries, TvType.Movie, TvType.AsianDrama, TvType.Anime) + + private fun String.getIntFromText(): Int? { + return Regex("""\d+""").find(this)?.groupValues?.firstOrNull()?.toIntOrNull() + } + + private fun String.getFullSize(): String? { + return this.replace("""-\d+x\d+""".toRegex(),"") + } + + private fun String.cleanTitle(): String { + val prefix = setOf("مشاهدة فيلم","مشاهدة وتحميل فيلم","تحميل","فيلم","انمي","إنمي","مسلسل","برنامج") + val suffix = setOf("مدبلج للعربية","اون لاين","مترجم") + this.let{ clean -> + var aa = clean + prefix.forEach{ pre -> + aa = if (aa.contains(pre)) aa.replace(pre,"") else aa } + var bb = aa + suffix.mapNotNull{ suf -> + bb = if (bb.contains(suf)) bb.replace(suf,"") else bb } + return bb + } + } + + private fun Element.toSearchResponse(): SearchResponse? { + val url = select(".BlockItem") + val title = url.select(".BlockTitle").text() + val img = url.select("img:last-of-type") + val posterUrl = img?.attr("src")?.ifEmpty { img?.attr("data-src") } + val year = url.select(".InfoEndBlock li").last()?.text()?.getIntFromText() + var quality = url.select(".RestInformation li").last()?.text()?.replace(" |-|1080p|720p".toRegex(), "")?.replace("BluRay","BLURAY") + val tvtype = if(title.contains("فيلم")) TvType.Movie else TvType.TvSeries + return MovieSearchResponse( + title.cleanTitle(), + url.select("a").attr("href"), + this@Movizland.name, + tvtype, + posterUrl, + year, + null, + quality = getQualityFromString(quality), + ) + } + override val mainPage = mainPageOf( + "$mainUrl/page/" to "أضيف حديثا", + "$mainUrl/category/movies/page/" to "أفلام", + "$mainUrl/series/page/" to "مسلسلات" + ) + + override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse { + val doc = app.get(request.data + page).document + val list = doc.select(".BlockItem").mapNotNull { element -> + element.toSearchResponse() + } + return newHomePageResponse(request.name, list) + } + + override suspend fun search(query: String): List { + val q = query.replace(" ".toRegex(), "%20") + val result = arrayListOf() + + val rlist = setOf( + "$mainUrl/?s=$q", + ) + rlist.forEach{ docs -> + val d = app.get(docs).document + d.select(".BlockItem").mapNotNull { + it.toSearchResponse()?.let { + it1 -> result.add(it1) + } + } + } + return result + } + +private val seasonPatterns = arrayOf( + Pair("الموسم العاشر|الموسم 10", 10), + Pair("الموسم الحادي عشر|الموسم 11", 11), + Pair("الموسم الثاني عشر|الموسم 12", 12), + Pair("الموسم الثالث عشر|الموسم 13", 13), + Pair("الموسم الرابع عشر|الموسم 14", 14), + Pair("الموسم الخامس عشر|الموسم 15", 15), + Pair("الموسم السادس عشر|الموسم 16", 16), + Pair("الموسم السابع عشر|الموسم 17", 17), + Pair("الموسم الثامن عشر|الموسم 18", 18), + Pair("الموسم التاسع عشر|الموسم 19", 19), + Pair("الموسم العشرون|الموسم 20", 20), + Pair("الموسم الاول|الموسم 1", 1), + Pair("الموسم الثاني|الموسم 2", 2), + Pair("الموسم الثالث|الموسم 3", 3), + Pair("الموسم الرابع|الموسم 4", 4), + Pair("الموسم الخامس|الموسم 5", 5), + Pair("الموسم السادس|الموسم 6", 6), + Pair("الموسم السابع|الموسم 7", 7), + Pair("الموسم الثامن|الموسم 8", 8), + Pair("الموسم التاسع|الموسم 9", 9), +) + +private fun getSeasonFromString(sName: String): Int { + return seasonPatterns.firstOrNull{(pattern, seasonNum) -> sName.contains(pattern.toRegex()) }?.second ?: 1 +} + + override suspend fun load(url: String): LoadResponse { + var doc = app.get(url).document + val sdetails = doc.select(".SingleDetails") + var posterUrl = sdetails.select("img")?.attr("data-src")?.getFullSize() + val year = sdetails.select("li:has(.fa-clock) a").text()?.getIntFromText() + var title = doc.select("h2.postTitle").text() + val isMovie = title.contains("عرض|فيلم".toRegex()) + val synopsis = doc.select("section.story").text() + val trailer = doc.select("div.InnerTrailer iframe").attr("data-src") + var tags = sdetails.select("li:has(.fa-film) a").map{ it.text() } + val recommendations = doc.select(".BlocksUI#LoadFilter .BlockItem").mapNotNull { element -> + element.toSearchResponse() + } + + + return if (isMovie) { + newMovieLoadResponse( + title.cleanTitle().replace("$year",""), + url, + TvType.Movie, + url + ) { + this.posterUrl = posterUrl + this.year = year + this.tags = tags + this.plot = synopsis + this.recommendations = recommendations + addTrailer(trailer) + } + } else { + val episodes = ArrayList() + val episodesItem = doc.select(".EpisodesList").isNotEmpty() + val fBlock = doc.select(".BlockItem")?.first() + val img = fBlock?.select("img:last-of-type") + + if(episodesItem){ + title = doc.select(".SeriesSingle .ButtonsFilter.WidthAuto span").text() + doc.select(".EpisodesList .EpisodeItem").map{ element -> + if(!element.text().contains("Full")){ + episodes.add( + Episode( + element.select("a").attr("href"), + null, + null, + element.select("em").text().getIntFromText(), + null, + null, + ) + ) + } + } + newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) { + this.posterUrl = posterUrl + this.year = year + this.tags = tags + this.plot = synopsis + this.recommendations = recommendations + addTrailer(trailer) + } + }else{ + posterUrl = img?.attr("src")?.ifEmpty { img?.attr("data-src") } + tags = fBlock?.select(".RestInformation span")!!.mapNotNull { t -> + t.text() + } + title = doc.select(".PageTitle .H1Title").text().cleanTitle() + if(doc.select(".BlockItem a").attr("href").contains("/series/")){//seasons + doc.select(".BlockItem").map { seas -> + seas.select("a").attr("href") }.apmap{ pageIt -> + val Sedoc = app.get(pageIt).document + val pagEl = Sedoc.select(".pagination > div > ul > li").isNotEmpty() + if(pagEl) { + Sedoc.select(".pagination > div > ul > li:nth-child(n):not(:last-child) a").apmap { + val epidoc = app.get(it.attr("href")).document + epidoc.select(".BlockItem").map{ element -> + episodes.add( + Episode( + element.select("a").attr("href"), + element.select(".BlockTitle").text(), + getSeasonFromString(element.select(".BlockTitle").text()), + element.select(".EPSNumber").text().getIntFromText(), + element.select("img:last-of-type").attr("src")?.ifEmpty { img?.attr("data-src") }, + null, + ) + ) + } + } + }else{ + Sedoc.select(".BlockItem").map{ el -> + episodes.add( + Episode( + el.select("a").attr("href"), + el.select(".BlockTitle").text(), + getSeasonFromString(el.select(".BlockTitle").text()), + el.select(".EPSNumber").text().getIntFromText(), + el.select("img:last-of-type").attr("src")?.ifEmpty { img?.attr("data-src") }, + null, + ) + ) + } + } + } + + } else {//episodes + val pagEl = doc.select(".pagination > div > ul > li.active > a").isNotEmpty() + val pagSt = if(pagEl) true else false + if(pagSt){ + doc.select(".pagination > div > ul > li:nth-child(n):not(:last-child) a").map{ eppages -> + eppages.attr("href") }.apmap{ + val epidoc = app.get(it).document + epidoc.select(".BlockItem").map{ element -> + episodes.add( + Episode( + element.select("a").attr("href"), + element.select(".BlockTitle").text(), + getSeasonFromString(element.select(".BlockTitle").text()), + element.select(".EPSNumber").text().getIntFromText(), + element.select("img:last-of-type").attr("src")?.ifEmpty { img?.attr("data-src") }, + null, + ) + ) + } + } + }else{ + doc.select(".BlockItem").map{ el -> + episodes.add( + Episode( + el.select("a").attr("href"), + el.select(".BlockTitle").text(), + getSeasonFromString(el.select(".BlockTitle").text()), + el.select(".EPSNumber").text().getIntFromText(), + el.select("img:last-of-type").attr("src")?.ifEmpty { img?.attr("data-src") }, + null, + ) + ) + } + } + } + + newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) { + this.posterUrl = posterUrl?.getFullSize() + this.tags = tags + } + } + } + } +override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + val doc = app.get(data).document + doc.select("code[id*='Embed'] iframe,.DownloadsList a").apmap { + var sourceUrl = it.attr("data-srcout").ifEmpty { it.attr("href") } + loadExtractor(sourceUrl, data, subtitleCallback, callback) + } + return true + } +} diff --git a/MovizlandProvider/src/main/kotlin/com/movizland/MovizlandProvider.kt b/MovizlandProvider/src/main/kotlin/com/movizland/MovizlandProvider.kt index 4ba810d..7479905 100644 --- a/MovizlandProvider/src/main/kotlin/com/movizland/MovizlandProvider.kt +++ b/MovizlandProvider/src/main/kotlin/com/movizland/MovizlandProvider.kt @@ -1,10 +1,10 @@ package com.movizland + import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer import com.lagradost.cloudstream3.utils.ExtractorLink import com.lagradost.cloudstream3.utils.Qualities -import com.lagradost.cloudstream3.utils.getQualityFromName import com.lagradost.cloudstream3.utils.loadExtractor import org.jsoup.nodes.Element @@ -19,6 +19,10 @@ class Movizland : MainAPI() { private fun String.getIntFromText(): Int? { return Regex("""\d+""").find(this)?.groupValues?.firstOrNull()?.toIntOrNull() } + + private fun String.getFullSize(): String? { + return this.replace("""-\d+x\d+""".toRegex(),"") + } private fun String.cleanTitle(): String { val prefix = setOf("مشاهدة فيلم","مشاهدة وتحميل فيلم","تحميل","فيلم","انمي","إنمي","مسلسل","برنامج") @@ -36,32 +40,31 @@ class Movizland : MainAPI() { private fun Element.toSearchResponse(): SearchResponse? { val url = select(".BlockItem") - val title = url.select(".BlockTitle").text().cleanTitle() + val title = url.select(".BlockTitle").text() val img = url.select("img:last-of-type") - val posterUrl = img?.attr("src")?.ifEmpty { img?.attr("data-src") } - val year = select(".InfoEndBlock li").last()?.text()?.getIntFromText() - var quality = select(".RestInformation li").last()?.text()?.replace(" |-|1080p|720p".toRegex(), "") - ?.replace("WEB DL","WEBDL")?.replace("BluRay","BLURAY") + val posterUrl = img?.attr("src")?.ifEmpty { img?.attr("data-src") } + val year = url.select(".InfoEndBlock li").last()?.text()?.getIntFromText() + var quality = url.select(".RestInformation li").last()?.text()?.replace(" |-|1080p|720p".toRegex(), "")?.replace("BluRay","BLURAY") + val tvtype = if(title.contains("فيلم")) TvType.Movie else TvType.TvSeries return MovieSearchResponse( - title.replace("$year",""), + title.cleanTitle(), url.select("a").attr("href"), this@Movizland.name, - TvType.TvSeries, + tvtype, posterUrl, year, null, quality = getQualityFromString(quality), ) } - override val mainPage = mainPageOf( - "$mainUrl/page/" to "الحلقات و الافلام المضافة حديثا", + "$mainUrl/page/" to "أضيف حديثا", "$mainUrl/category/movies/page/" to "أفلام", - "$mainUrl/series/page/" to "مسلسلات", + "$mainUrl/series/page/" to "مسلسلات" ) override suspend fun getMainPage(page: Int, request : MainPageRequest): HomePageResponse { - val doc = app.get(request.data + page).document + val doc = app.get(request.data + page).document val list = doc.select(".BlockItem").mapNotNull { element -> element.toSearchResponse() } @@ -69,55 +72,68 @@ class Movizland : MainAPI() { } override suspend fun search(query: String): List { - val d = app.get("$mainUrl/?s=$query").document - return d.select(".BlockItem").mapNotNull { - if(it.select(".BlockTitle").text().contains("الحلقة")) return@mapNotNull null; - it.toSearchResponse() + val q = query.replace(" ".toRegex(), "%20") + val result = arrayListOf() + + val rlist = setOf( + "$mainUrl/?s=$q", + ) + rlist.forEach{ docs -> + val d = app.get(docs).document + d.select(".BlockItem").mapNotNull { + it.toSearchResponse()?.let { + it1 -> result.add(it1) + } + } } + return result } - - private fun getSeasonFromString(sName: String): Int { - return when (sName.isNotEmpty()) { - sName.contains("الموسم الاول|الموسم 1".toRegex()) -> 1 - sName.contains("الموسم الحادي عشر|الموسم 11".toRegex()) -> 11 - sName.contains("الموسم الثاني عشر|الموسم 12".toRegex()) -> 12 - sName.contains("الموسم الثالث عشر|الموسم 13".toRegex()) -> 13 - sName.contains("الموسم الرابع عشر|الموسم 14".toRegex()) -> 14 - sName.contains("الموسم الخامس عشر|الموسم 15".toRegex()) -> 15 - sName.contains("الموسم السادس عشر|الموسم 16".toRegex()) -> 16 - sName.contains("الموسم السابع عشر|الموسم 17".toRegex()) -> 17 - sName.contains("الموسم الثامن عشر|الموسم 18".toRegex()) -> 18 - sName.contains("الموسم التاسع عشر|الموسم 19".toRegex()) -> 19 - sName.contains("الموسم الثاني|الموسم 2".toRegex()) -> 2 - sName.contains("الموسم الثالث|الموسم 3".toRegex()) -> 3 - sName.contains("الموسم الرابع|الموسم 4".toRegex()) -> 4 - sName.contains("الموسم الخامس|الموسم 5".toRegex()) -> 5 - sName.contains("الموسم السادس|الموسم 6".toRegex()) -> 6 - sName.contains("الموسم السابع|الموسم 7".toRegex()) -> 7 - sName.contains("الموسم الثامن|الموسم 8".toRegex()) -> 8 - sName.contains("الموسم التاسع|الموسم 9".toRegex()) -> 9 - sName.contains("الموسم العاشر|الموسم 10".toRegex()) -> 10 - sName.contains("الموسم العشرون|الموسم 20".toRegex()) -> 20 - else -> 1 - } - } - + +private val seasonPatterns = arrayOf( + Pair("الموسم العاشر|الموسم 10", 10), + Pair("الموسم الحادي عشر|الموسم 11", 11), + Pair("الموسم الثاني عشر|الموسم 12", 12), + Pair("الموسم الثالث عشر|الموسم 13", 13), + Pair("الموسم الرابع عشر|الموسم 14", 14), + Pair("الموسم الخامس عشر|الموسم 15", 15), + Pair("الموسم السادس عشر|الموسم 16", 16), + Pair("الموسم السابع عشر|الموسم 17", 17), + Pair("الموسم الثامن عشر|الموسم 18", 18), + Pair("الموسم التاسع عشر|الموسم 19", 19), + Pair("الموسم العشرون|الموسم 20", 20), + Pair("الموسم الاول|الموسم 1", 1), + Pair("الموسم الثاني|الموسم 2", 2), + Pair("الموسم الثالث|الموسم 3", 3), + Pair("الموسم الرابع|الموسم 4", 4), + Pair("الموسم الخامس|الموسم 5", 5), + Pair("الموسم السادس|الموسم 6", 6), + Pair("الموسم السابع|الموسم 7", 7), + Pair("الموسم الثامن|الموسم 8", 8), + Pair("الموسم التاسع|الموسم 9", 9), +) + +private fun getSeasonFromString(sName: String): Int { + return seasonPatterns.firstOrNull{(pattern, seasonNum) -> sName.contains(pattern.toRegex()) }?.second ?: 1 +} + override suspend fun load(url: String): LoadResponse { var doc = app.get(url).document val sdetails = doc.select(".SingleDetails") - val posterUrl = sdetails.select(".Poster img").attr("data-src").ifEmpty { - sdetails.select(".BlockItem").last()?.select(".Poster img")?.attr("src") - } + var posterUrl = sdetails.select("img")?.attr("data-src")?.getFullSize() val year = sdetails.select("li:has(.fa-clock) a").text()?.getIntFromText() - val title = doc.select("h2.postTitle").text().cleanTitle().replace("$year","") - val isMovie = doc.select("h2.postTitle").text().contains("عرض|فيلم".toRegex()) + var title = doc.select("h2.postTitle").text() + val isMovie = title.contains("عرض|فيلم".toRegex()) val synopsis = doc.select("section.story").text() val trailer = doc.select("div.InnerTrailer iframe").attr("data-src") - val tags = sdetails.select("li:has(.fa-film) a").map{ it.text() } + var tags = sdetails.select("li:has(.fa-film) a").map{ it.text() } + val recommendations = doc.select(".BlocksUI#LoadFilter .BlockItem").mapNotNull { element -> + element.toSearchResponse() + } + return if (isMovie) { newMovieLoadResponse( - title, + title.cleanTitle().replace("$year",""), url, TvType.Movie, url @@ -126,12 +142,45 @@ class Movizland : MainAPI() { this.year = year this.tags = tags this.plot = synopsis - addTrailer(trailer) + this.recommendations = recommendations + addTrailer(trailer) } } else { val episodes = ArrayList() - val pageUrl = doc.select("meta[property='og:url']").attr("content") - val refererUrl = doc.select("body > header > div > div.Logo > a").attr("href") + val episodesItem = doc.select(".EpisodesList").isNotEmpty() + val fBlock = doc.select(".BlockItem")?.first() + val img = fBlock?.select("img:last-of-type") + + if(episodesItem){ + title = doc.select(".SeriesSingle .ButtonsFilter.WidthAuto span").text() + doc.select(".EpisodesList .EpisodeItem").map{ element -> + if(!element.text().contains("Full")){ + episodes.add( + Episode( + element.select("a").attr("href"), + null, + null, + element.select("em").text().getIntFromText(), + null, + null, + ) + ) + } + } + newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) { + this.posterUrl = posterUrl + this.year = year + this.tags = tags + this.plot = synopsis + this.recommendations = recommendations + addTrailer(trailer) + } + }else{ + posterUrl = img?.attr("src")?.ifEmpty { img?.attr("data-src") } + tags = fBlock?.select(".RestInformation span")!!.mapNotNull { t -> + t.text() + } + title = doc.select(".PageTitle .H1Title").text().cleanTitle() if(doc.select(".BlockItem a").attr("href").contains("/series/")){//seasons doc.select(".BlockItem").map { seas -> seas.select("a").attr("href") }.apmap{ pageIt -> @@ -140,13 +189,15 @@ class Movizland : MainAPI() { if(pagEl) { Sedoc.select(".pagination > div > ul > li:nth-child(n):not(:last-child) a").apmap { val epidoc = app.get(it.attr("href")).document - epidoc.select("div.BlockItem").map{ element -> + epidoc.select(".BlockItem").map{ element -> episodes.add( Episode( element.select("a").attr("href"), element.select(".BlockTitle").text(), getSeasonFromString(element.select(".BlockTitle").text()), element.select(".EPSNumber").text().getIntFromText(), + element.select("img:last-of-type").attr("src")?.ifEmpty { img?.attr("data-src") }, + null, ) ) } @@ -159,6 +210,8 @@ class Movizland : MainAPI() { el.select(".BlockTitle").text(), getSeasonFromString(el.select(".BlockTitle").text()), el.select(".EPSNumber").text().getIntFromText(), + el.select("img:last-of-type").attr("src")?.ifEmpty { img?.attr("data-src") }, + null, ) ) } @@ -172,25 +225,29 @@ class Movizland : MainAPI() { doc.select(".pagination > div > ul > li:nth-child(n):not(:last-child) a").map{ eppages -> eppages.attr("href") }.apmap{ val epidoc = app.get(it).document - epidoc.select("div.BlockItem").map{ element -> + epidoc.select(".BlockItem").map{ element -> episodes.add( Episode( element.select("a").attr("href"), element.select(".BlockTitle").text(), getSeasonFromString(element.select(".BlockTitle").text()), - element.select(".EPSNumber").text().getIntFromText(), + element.select(".EPSNumber").text().getIntFromText(), + element.select("img:last-of-type").attr("src")?.ifEmpty { img?.attr("data-src") }, + null, ) ) } } }else{ - doc.select("div.BlockItem").map{ el -> + doc.select(".BlockItem").map{ el -> episodes.add( Episode( el.select("a").attr("href"), el.select(".BlockTitle").text(), getSeasonFromString(el.select(".BlockTitle").text()), el.select(".EPSNumber").text().getIntFromText(), + el.select("img:last-of-type").attr("src")?.ifEmpty { img?.attr("data-src") }, + null, ) ) } @@ -198,25 +255,22 @@ class Movizland : MainAPI() { } newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) { - /*this.posterUrl = posterUrl - this.year = year - this.tags = tags - this.plot = synopsis - addTrailer(trailer)*/ + this.posterUrl = posterUrl?.getFullSize() + this.tags = tags } } } - - override suspend fun loadLinks( - data: String, - isCasting: Boolean, - subtitleCallback: (SubtitleFile) -> Unit, - callback: (ExtractorLink) -> Unit - ): Boolean { - val doc = app.get(data).document - doc.select("code[id*='Embed'] iframe").apmap { - var sourceUrl = it.attr("data-srcout") - loadExtractor(sourceUrl, data, subtitleCallback, callback) + } +override suspend fun loadLinks( + data: String, + isCasting: Boolean, + subtitleCallback: (SubtitleFile) -> Unit, + callback: (ExtractorLink) -> Unit + ): Boolean { + val doc = app.get(data).document + doc.select("code[id*='Embed'] iframe,.DownloadsList a").apmap { + var sourceUrl = it.attr("data-srcout").ifEmpty { it.attr("href") } + loadExtractor(sourceUrl, data, subtitleCallback, callback) } return true } diff --git a/MyCimaProvider/build.gradle.kts b/MyCimaProvider/build.gradle.kts index a8adfc9..9cc99ef 100644 --- a/MyCimaProvider/build.gradle.kts +++ b/MyCimaProvider/build.gradle.kts @@ -1,4 +1,4 @@ -version = 3 +version = 4 cloudstream { description = "" diff --git a/MyCimaProvider/src/main/kotlin/com/mycima/MyCimaPlugin.kt b/MyCimaProvider/src/main/kotlin/com/mycima/MyCimaPlugin.kt index 4220e76..d5a7533 100644 --- a/MyCimaProvider/src/main/kotlin/com/mycima/MyCimaPlugin.kt +++ b/MyCimaProvider/src/main/kotlin/com/mycima/MyCimaPlugin.kt @@ -7,5 +7,6 @@ import android.content.Context class MyCimaPlugin: Plugin() { override fun load(context: Context) { registerMainAPI(MyCima()) + registerExtractorAPI(MyVid()) } } \ No newline at end of file diff --git a/MyCimaProvider/src/main/kotlin/com/mycima/myvid.kt b/MyCimaProvider/src/main/kotlin/com/mycima/myvid.kt new file mode 100644 index 0000000..62d62be --- /dev/null +++ b/MyCimaProvider/src/main/kotlin/com/mycima/myvid.kt @@ -0,0 +1,32 @@ +package com.mycima + +import com.lagradost.cloudstream3.utils.ExtractorApi +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.Qualities +import com.lagradost.cloudstream3.app + +open class MyVid : ExtractorApi() { + override val name = "MyVid" + override val mainUrl = "https://myviid.com" + override val requiresReferer = false + + override suspend fun getUrl(url: String, referer: String?): List { + val sources = mutableListOf() + val text = app.get(url).document.select("body > script:nth-child(2)").html() ?: "" + val a = text.substringAfter("||||").substringBefore("'.split").split("|") + val link = "${a[7]}://${a[24]}.${a[6]}.${a[5]}/${a[83]}/v.${a[82]}" + if (link.isNotBlank()) { + sources.add( + ExtractorLink( + name = name, + source = name, + url = link, + isM3u8 = false, + quality = "${a[80]}".replace("p","").toInt() ?: Qualities.Unknown.value, + referer = "$mainUrl/" + ) + ) + } + return sources + } +} diff --git a/Shahid4uProvider/build.gradle.kts b/Shahid4uProvider/build.gradle.kts index 5f9f121..24065b6 100644 --- a/Shahid4uProvider/build.gradle.kts +++ b/Shahid4uProvider/build.gradle.kts @@ -1,4 +1,4 @@ -version = 6 +version = 7 cloudstream { description = "" diff --git a/Shahid4uProvider/src/main/kotlin/com/shahid4u/JWPlayerExtractor.kt b/Shahid4uProvider/src/main/kotlin/com/shahid4u/JWPlayerExtractor.kt index a7ca06c..d61a934 100644 --- a/Shahid4uProvider/src/main/kotlin/com/shahid4u/JWPlayerExtractor.kt +++ b/Shahid4uProvider/src/main/kotlin/com/shahid4u/JWPlayerExtractor.kt @@ -57,10 +57,6 @@ class VidHD : JWPlayer() { override val name = "VidHD" override val mainUrl = "https://vidhd.fun" } -class GoStream : JWPlayer() { - override val name = "GoStream" - override val mainUrl = "https://gostream.pro" -} class Vidbom : JWPlayer() { override val name = "Vidbom" override val mainUrl = "https://vidbom.com" diff --git a/Shahid4uProvider/src/main/kotlin/com/shahid4u/Shahid4uProvider.kt b/Shahid4uProvider/src/main/kotlin/com/shahid4u/Shahid4uProvider.kt index 155bb7f..9e5272a 100644 --- a/Shahid4uProvider/src/main/kotlin/com/shahid4u/Shahid4uProvider.kt +++ b/Shahid4uProvider/src/main/kotlin/com/shahid4u/Shahid4uProvider.kt @@ -8,7 +8,7 @@ import org.jsoup.nodes.Element class Shahid4u : MainAPI() { override var lang = "ar" - override var mainUrl = "https://shahed4u.vip" + override var mainUrl = "https://shaheed4u.me/" override var name = "Shahid4u" override val usesWebView = false override val hasMainPage = true diff --git a/Shahid4uProvider/src/main/kotlin/com/shahid4u/gostream.kt b/Shahid4uProvider/src/main/kotlin/com/shahid4u/gostream.kt new file mode 100644 index 0000000..bb3c121 --- /dev/null +++ b/Shahid4uProvider/src/main/kotlin/com/shahid4u/gostream.kt @@ -0,0 +1,33 @@ +package com.shahid4u + +import com.lagradost.cloudstream3.utils.ExtractorApi +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.Qualities +import com.lagradost.cloudstream3.app + +open class GoStream : ExtractorApi() { + override val name = "GoStream" + override val mainUrl = "https://gostream.pro" + override val requiresReferer = false + + override suspend fun getUrl(url: String, referer: String?): List { + val sources = mutableListOf() + val text = app.get(url).document.select("#player_code > script:nth-child(4)").html() ?: "" + val a = text.split("|") + val b = a[0].substring(a[0].lastIndexOf("http")) + val link = "$b://${a[5]}.${a[4]}-${a[3]}.${a[2]}:${a[11]}/d/${a[10]}/${a[9]}.${a[8]}" + if (link.isNotBlank()) { + sources.add( + ExtractorLink( + name = name, + source = name, + url = link, + isM3u8 = false, + quality = Qualities.Unknown.value, + referer = "$mainUrl/" + ) + ) + } + return sources + } +} diff --git a/Shahid4uProvider/src/main/kotlin/com/shahid4u/vidhd.kt b/Shahid4uProvider/src/main/kotlin/com/shahid4u/vidhd.kt new file mode 100644 index 0000000..74787fb --- /dev/null +++ b/Shahid4uProvider/src/main/kotlin/com/shahid4u/vidhd.kt @@ -0,0 +1,46 @@ +package com.shahid4u + +import com.lagradost.cloudstream3.utils.ExtractorApi +import com.lagradost.cloudstream3.utils.ExtractorLink +import com.lagradost.cloudstream3.utils.Qualities +import com.lagradost.cloudstream3.app + +open class VidHD : ExtractorApi() { + override val name = "VidHD" + override val mainUrl = "https://vidhd.fun" + override val requiresReferer = false + + private fun String.getIntFromText(): Int? { + return Regex("""\d+""").find(this)?.groupValues?.firstOrNull()?.toIntOrNull() + } + + override suspend fun getUrl(url: String, referer: String?): List { + val sources = mutableListOf() + app.get(url).document.select("body > script:nth-child(2)").html().substringAfter("||||").let{ c-> + val a = c.split("|") + val b = c.substringAfter("|image|").split("|") + val f = c.substringAfter("|label|").substringBefore("|file|") + val e = "${a[6]}://${a[21]}.e-${a[20]}-${a[19]}.${a[18]}/${b[1]}/v.$f" + val d = e.replace(b[1],b[3]) + val links: MutableMap = mutableMapOf( + e to b[0].getIntFromText(), + d to b[2].getIntFromText(), + ) + links.forEach { (watchlink, quality) -> + if(watchlink.isNotBlank()){ + sources.add( + ExtractorLink( + name = name, + source = name, + url = watchlink, + isM3u8 = false, + quality = quality ?: Qualities.Unknown.value, + referer = "$mainUrl/" + ) + ) + } + } + } + return sources + } + }