From 19456eb26e2c10db31e2910ac185e039b2ee26aa Mon Sep 17 00:00:00 2001 From: Nexus <79303560+Nexus-Gits@users.noreply.github.com> Date: Sat, 27 Jan 2024 20:09:31 +0530 Subject: [PATCH] Create UncutMaza.kt --- .../src/main/kotlin/com/hexated/UncutMaza.kt | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 UncutMaza/src/main/kotlin/com/hexated/UncutMaza.kt diff --git a/UncutMaza/src/main/kotlin/com/hexated/UncutMaza.kt b/UncutMaza/src/main/kotlin/com/hexated/UncutMaza.kt new file mode 100644 index 00000000..4421d0b5 --- /dev/null +++ b/UncutMaza/src/main/kotlin/com/hexated/UncutMaza.kt @@ -0,0 +1,97 @@ +package com.hexated + +import org.jsoup.nodes.Element +import com.lagradost.cloudstream3.* +import com.lagradost.cloudstream3.utils.* + +class UncutMaza : MainAPI() { + override var mainUrl = "https://uncutmaza.cc" + override var name = "UncutMaza" + override val hasMainPage = true + override var lang = "hi" + override val hasQuickSearch = false + override val hasDownloadSupport = true + override val hasChromecastSupport = true + override val supportedTypes = setOf(TvType.NSFW) + override val vpnStatus = VPNStatus.MightBeNeeded + + override val mainPage = mainPageOf( + "${mainUrl}/page/" to "Home", + "${mainUrl}/category/niks-indian-porn/page/" to "Niks Indian" + ) + + override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse { + val document = app.get(request.data + page).document + val home = document.select("div.videos-list > article.post").mapNotNull { it.toSearchResult() } + + return newHomePageResponse( + list = HomePageList( + name = request.name, + list = home, + isHorizontalImages = true + ), + hasNext = true + ) + } + + private fun Element.toSearchResult(): SearchResponse { + val title = fixTitle(this.select("a").attr("title")) + val href = fixUrl(this.select("a").attr("href")) + val posterUrl = fixUrlNull(this.select("a > div.post-thumbnail>div.post-thumbnail-container>img").attr("data-src")) + + return newMovieSearchResponse(title, href, TvType.Movie) { + this.posterUrl = posterUrl + } + } + + override suspend fun search(query: String): List { + val searchResponse = mutableListOf() + + for (i in 1..5) { + val document = app.get("${mainUrl}/page/$i?s=$query").document + + val results = document.select("article.post").mapNotNull { it.toSearchResult() } + + if (!searchResponse.containsAll(results)) { + searchResponse.addAll(results) + } else { + break + } + + if (results.isEmpty()) break + } + + return searchResponse + } + + override suspend fun load(url: String): LoadResponse { + val document = app.get(url).document + + val title = document.selectFirst("meta[property=og:title]")?.attr("content")?.trim().toString() + val poster = fixUrlNull(document.selectFirst("meta[property=og:image]")?.attr("content").toString()) + val description = document.selectFirst("meta[property=og:description]")?.attr("content")?.trim() + + return newMovieLoadResponse(title, url, TvType.NSFW, url) { + this.posterUrl = poster + this.plot = description + } + } + + override suspend fun loadLinks(data: String, isCasting: Boolean, subtitleCallback: (SubtitleFile) -> Unit, callback: (ExtractorLink) -> Unit): Boolean { + val document = app.get(data).document + + document.select("div.video-player").map { res -> + callback.invoke( + ExtractorLink( + source = this.name, + name = this.name, + url = fixUrl(res.selectFirst("meta[itemprop=contentURL]")?.attr("content")?.trim().toString()), + referer = data, + quality = Qualities.Unknown.value + ) + ) + } + + return true + } +}