From 80ce5b4d7ea3bd2ccba1dfe5c94bc37cb49f30ae Mon Sep 17 00:00:00 2001
From: Owen <96526481+owencz1998@users.noreply.github.com>
Date: Sat, 30 Nov 2024 09:10:23 +0000
Subject: [PATCH] added Xmaza
---
Xmaza/build.gradle.kts | 18 ++++
Xmaza/src/main/AndroidManifest.xml | 2 +
Xmaza/src/main/kotlin/com/Xmaza/Xmaza.kt | 87 +++++++++++++++++++
.../main/kotlin/com/Xmaza/XmazaProvider.kt | 12 +++
4 files changed, 119 insertions(+)
create mode 100644 Xmaza/build.gradle.kts
create mode 100644 Xmaza/src/main/AndroidManifest.xml
create mode 100644 Xmaza/src/main/kotlin/com/Xmaza/Xmaza.kt
create mode 100644 Xmaza/src/main/kotlin/com/Xmaza/XmazaProvider.kt
diff --git a/Xmaza/build.gradle.kts b/Xmaza/build.gradle.kts
new file mode 100644
index 0000000..6be37ce
--- /dev/null
+++ b/Xmaza/build.gradle.kts
@@ -0,0 +1,18 @@
+version = 15
+
+cloudstream {
+ authors = listOf("Phisher98")
+ language = "en"
+ description = "Indian 18+ Web Series"
+
+ /**
+ * Status int as the following:
+ * 0: Down
+ * 1: Ok
+ * 2: Slow
+ * 3: Beta only
+ **/
+ status = 1 // will be 3 if unspecified
+ tvTypes = listOf("NSFW")
+ iconUrl = "https://t3.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=https://xmaza.net&size=16"
+}
diff --git a/Xmaza/src/main/AndroidManifest.xml b/Xmaza/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..3f4d39b
--- /dev/null
+++ b/Xmaza/src/main/AndroidManifest.xml
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/Xmaza/src/main/kotlin/com/Xmaza/Xmaza.kt b/Xmaza/src/main/kotlin/com/Xmaza/Xmaza.kt
new file mode 100644
index 0000000..cf6856c
--- /dev/null
+++ b/Xmaza/src/main/kotlin/com/Xmaza/Xmaza.kt
@@ -0,0 +1,87 @@
+package com.Xmaza
+
+import org.jsoup.nodes.Element
+import com.lagradost.cloudstream3.*
+import com.lagradost.cloudstream3.utils.*
+
+class Xmaza : MainAPI() {
+ override var mainUrl = "https://xmaza.net"
+ override var name = "Xmaza"
+ 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(
+ "" to "Home",
+ "ullu-c14" to "Ullu",
+ "triflicks" to "Triflicks",
+ "primeplay-c1" to "PrimePlay",
+ "kooku" to "Kooku",
+ "atragii-c8" to "Atragii",
+ "rabbit" to "Rabbit",
+ "hunters" to "Hunters"
+ )
+
+ override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
+ val document = app.get("$mainUrl/${request.data}/page/$page").document
+ val home = document.select("div.videos a").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.attr("title")).trim()
+ val href = fixUrl(this.attr("href"))
+ val posterUrl = fixUrlNull(this.attr("style").substringAfter("background-image: url('").substringBefore("'"))
+
+ return newMovieSearchResponse(title, href, TvType.Movie) {
+ this.posterUrl = posterUrl
+ }
+ }
+
+ override suspend fun search(query: String): List {
+ val document = app.get("${mainUrl}?s=$query").document
+ val results = document.select("div.videos a").mapNotNull { it.toSearchResult() }
+ return results
+ }
+
+ 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("[property='og:image']")?.attr("content"))
+ 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
+ val source=document.selectFirst("#my-video source")?.attr("src") ?:""
+ callback.invoke(
+ ExtractorLink(
+ source = this.name,
+ name = this.name,
+ url = source,
+ referer = data,
+ quality = Qualities.Unknown.value
+ )
+ )
+ return true
+ }
+}
\ No newline at end of file
diff --git a/Xmaza/src/main/kotlin/com/Xmaza/XmazaProvider.kt b/Xmaza/src/main/kotlin/com/Xmaza/XmazaProvider.kt
new file mode 100644
index 0000000..371a43c
--- /dev/null
+++ b/Xmaza/src/main/kotlin/com/Xmaza/XmazaProvider.kt
@@ -0,0 +1,12 @@
+package com.Xmaza
+
+import com.lagradost.cloudstream3.plugins.CloudstreamPlugin
+import com.lagradost.cloudstream3.plugins.Plugin
+import android.content.Context
+
+@CloudstreamPlugin
+class XmazaProvider: Plugin() {
+ override fun load(context: Context) {
+ registerMainAPI(Xmaza())
+ }
+}
\ No newline at end of file