-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
64e3b21
commit 167251d
Showing
4 changed files
with
141 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// use an integer for version numbers | ||
version = 1 | ||
|
||
|
||
cloudstream { | ||
// All of these properties are optional, you can safely remove them | ||
|
||
description = "Pornmz" | ||
language = "en" | ||
authors = listOf("megix") | ||
|
||
/** | ||
* Status int as the following: | ||
* 0: Down | ||
* 1: Ok | ||
* 2: Slow | ||
* 3: Beta only | ||
* */ | ||
status = 1 // will be 3 if unspecified | ||
|
||
// List of video source types. Users are able to filter for extensions in a given category. | ||
// You can find a list of avaliable types here: | ||
// https://recloudstream.github.io/cloudstream/html/app/com.lagradost.cloudstream3/-tv-type/index.html | ||
tvTypes = listOf("NSFW") | ||
iconUrl = "https://pornmz.com/wp-content/uploads/2021/03/PornMZ.png" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
package com.megix | ||
|
||
import org.jsoup.nodes.Element | ||
import com.lagradost.cloudstream3.* | ||
import com.lagradost.cloudstream3.utils.* | ||
|
||
class Pornmz : MainAPI() { | ||
override var mainUrl = "https://pornmz.com" | ||
override var name = "Pornmz" | ||
override val hasMainPage = true | ||
override var lang = "en" | ||
override val hasQuickSearch = false | ||
override val hasDownloadSupport = true | ||
override val supportedTypes = setOf(TvType.NSFW) | ||
override val vpnStatus = VPNStatus.MightBeNeeded | ||
|
||
override val mainPage = mainPageOf( | ||
"" to "Home", | ||
"/pmvideo/s/brazzers" to "Brazzers", | ||
"/pmvideo/s/bangbros" to "BangBros", | ||
"/pmvideo/s/naughtyamerica" to "NaughtyAmerica", | ||
"/pmvideo/s/realitykings" to "RealityKings", | ||
) | ||
|
||
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse { | ||
val document = app.get("$mainUrl${request.data}/page/$page/").document | ||
val home = document.select(".videos-list a").mapNotNull { it.toSearchResult() } | ||
|
||
return newHomePageResponse( | ||
list = HomePageList( | ||
name = request.name, | ||
list = home, | ||
isHorizontalImages = true | ||
), | ||
hasNext = true | ||
) | ||
} | ||
|
||
private fun Element.toSearchResult(): SearchResponse { | ||
val title = this.attr("title") | ||
val href = this.attr("href") | ||
var posterUrl = this.select("img").attr("src") | ||
if(posterUrl.isEmpty()) { | ||
posterUrl = this.select("video").attr("poster") | ||
} | ||
|
||
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(".videos-list a").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.select("meta[property=og:title]").attr("content") | ||
val poster = document.select("meta[property='og:image']").attr("content") | ||
val description = document.select("meta[property=og:description]").attr("content") | ||
|
||
|
||
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 iframe = document.select(".responsive-player iframe").attr("src") | ||
val source = app.get(iframe).document.select("video source").attr("src") | ||
|
||
callback.invoke( | ||
ExtractorLink( | ||
"Pornmz", | ||
"Pornmz", | ||
source, | ||
mainUrl, | ||
Qualities.Unknown.value | ||
) | ||
) | ||
return true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.megix | ||
|
||
import com.lagradost.cloudstream3.plugins.CloudstreamPlugin | ||
import com.lagradost.cloudstream3.plugins.Plugin | ||
import android.content.Context | ||
|
||
@CloudstreamPlugin | ||
class PornmzProvider: Plugin() { | ||
override fun load(context: Context) { | ||
registerMainAPI(Pornmz()) | ||
} | ||
} |