Create UncutMaza.kt

This commit is contained in:
Nexus 2024-01-27 20:09:31 +05:30 committed by GitHub
parent b5ef81f42f
commit 19456eb26e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 97 additions and 0 deletions

View File

@ -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<SearchResponse> {
val searchResponse = mutableListOf<SearchResponse>()
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
}
}