From cbd39e1c35493e68893b25ff84d31ca7b347b03c Mon Sep 17 00:00:00 2001 From: Spoonge Date: Wed, 1 Feb 2023 16:29:55 +0100 Subject: [PATCH] update movizland and akwam (#6) * added more extractors and fixed movizland * update movizland fushaar mycima shahed4u * added moshada extractor * fix akwam * Revert "Update build.gradle.kts" This reverts commit 0ac53c60c3ed5e72f83bfd4a592671dabae0dc27. * update MovizlandProvider --- AkwamProvider/build.gradle.kts | 2 +- .../main/kotlin/com/akwam/AkwamProvider.kt | 4 +- MovizlandProvider/build.gradle.kts | 2 +- .../src/main/kotlin/com/movizland/Moshahda.kt | 40 +++ .../com/movizland/MovizlandProvider copy.kt | 277 ------------------ 5 files changed, 43 insertions(+), 282 deletions(-) create mode 100644 MovizlandProvider/src/main/kotlin/com/movizland/Moshahda.kt delete mode 100644 MovizlandProvider/src/main/kotlin/com/movizland/MovizlandProvider copy.kt diff --git a/AkwamProvider/build.gradle.kts b/AkwamProvider/build.gradle.kts index dffbbc6..be469a2 100644 --- a/AkwamProvider/build.gradle.kts +++ b/AkwamProvider/build.gradle.kts @@ -1,4 +1,4 @@ -version = 1 +version = 2 cloudstream { description = "" diff --git a/AkwamProvider/src/main/kotlin/com/akwam/AkwamProvider.kt b/AkwamProvider/src/main/kotlin/com/akwam/AkwamProvider.kt index 6c2b2a7..5aa9090 100644 --- a/AkwamProvider/src/main/kotlin/com/akwam/AkwamProvider.kt +++ b/AkwamProvider/src/main/kotlin/com/akwam/AkwamProvider.kt @@ -77,9 +77,7 @@ class Akwam : MainAPI() { override suspend fun load(url: String): LoadResponse { val doc = app.get(url).document - val mesEl = doc.select("#downloads > h2 > span").isNotEmpty() - val mesSt = if(mesEl) true else false - val isMovie = mesSt//url.contains("/movie/") + val isMovie = doc.select("#downloads > h2 > span").isNotEmpty()//url.contains("/movie/") val title = doc.select("h1.entry-title").text() val posterUrl = doc.select("picture > img").attr("src") diff --git a/MovizlandProvider/build.gradle.kts b/MovizlandProvider/build.gradle.kts index f0e8534..15aac5d 100644 --- a/MovizlandProvider/build.gradle.kts +++ b/MovizlandProvider/build.gradle.kts @@ -1,4 +1,4 @@ -version = 4 +version = 5 cloudstream { description = "Not recommended for series." diff --git a/MovizlandProvider/src/main/kotlin/com/movizland/Moshahda.kt b/MovizlandProvider/src/main/kotlin/com/movizland/Moshahda.kt new file mode 100644 index 0000000..63f4e89 --- /dev/null +++ b/MovizlandProvider/src/main/kotlin/com/movizland/Moshahda.kt @@ -0,0 +1,40 @@ +package com.movizland + +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 Moshahda : ExtractorApi() { + override val name = "Moshahda" + override val mainUrl = "https://moshahda.net" + override val requiresReferer = true + + 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.html?" + if (code?.length == 12) { + mutableMapOf( + "download_l" to 240, + "download_n" to 360, + "download_h" to 480, + "download_x" to 720, + "download_o" to 1080, + ).forEach{ (key,qual) -> + sources.add( + ExtractorLink( + name = name, + source = name, + url = "${link}${key}", + isM3u8 = false, + quality = qual ?: Qualities.Unknown.value, + referer = "$mainUrl/" + ) + ) + } + } + return sources + } + } \ 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 deleted file mode 100644 index 7479905..0000000 --- a/MovizlandProvider/src/main/kotlin/com/movizland/MovizlandProvider copy.kt +++ /dev/null @@ -1,277 +0,0 @@ -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 - } -}