[Feature] Enable nsfw on Pinoy movie providers homepage (#7)

This commit is contained in:
Jace 2022-08-30 22:13:46 +08:00 committed by GitHub
parent 0164c86f81
commit a30277322a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 15 deletions

View file

@ -6,8 +6,8 @@ cloudstream {
language = "tl"
// All of these properties are optional, you can safely remove them
// description = "Lorem Ipsum"
// authors = listOf("Cloudburst")
description = "Pinoy HD Movies - High Definition"
authors = listOf("Jace")
/**
* Status int as the following:

View file

@ -1,5 +1,5 @@
// use an integer for version numbers
version = 1
version = 2
cloudstream {
@ -7,7 +7,7 @@ cloudstream {
// All of these properties are optional, you can safely remove them
description = "Includes PinoyMoviePediaProvider and PinoyMoviesEsProvider"
// authors = listOf("Cloudburst")
authors = listOf("Jace")
/**
* Status int as the following:

View file

@ -21,7 +21,7 @@ class PinoyMoviePediaProvider : MainAPI() {
val document = app.get(mainUrl).document
val mainbody = document.getElementsByTag("body")
// All rows will be hardcoded bc of the nature of the site
val rows: List<Pair<String, String>> = listOf(
val rows = listOf(
Pair("Latest Movies", "featured-titles"),
Pair("Movies", "dt-movies"),
Pair("Digitally Restored", "genre_digitally-restored"),
@ -29,8 +29,10 @@ class PinoyMoviePediaProvider : MainAPI() {
Pair("Romance", "genre_romance"),
Pair("Comedy", "genre_comedy"),
Pair("Family", "genre_family")
//Pair("Adult +18", "genre_pinay-sexy-movies")
)
).toMutableList()
if (settingsForProvider.enableAdult) {
rows.add(Pair("Adult +18", "genre_pinay-sexy-movies"))
}
rows.forEach { item ->
val title = item.first
val inner = mainbody?.select("div#${item.second} > article")

View file

@ -106,14 +106,19 @@ class PinoyMoviesEsProvider : MainAPI() {
all.addAll(homepage1)
}
//2nd rows
val listOfRows = listOf(
Pair("Action", "genre_action"),
Pair("Comedy", "genre_comedy"),
Pair("Romance", "genre_romance"),
Pair("Horror", "genre_horror")
).toMutableList()
if (settingsForProvider.enableAdult) {
listOfRows.add(Pair("Rated-R", "genre_rated-r"))
}
val homepage2 = getRowElements(
mainbody, listOf(
Pair("Action", "genre_action"),
Pair("Comedy", "genre_comedy"),
Pair("Romance", "genre_romance"),
Pair("Horror", "genre_horror")
//Pair("Rated-R", "genre_rated-r")
), "#"
mainbody = mainbody,
rows = listOfRows,
sep = "#"
)
if (homepage2.isNotEmpty()) {
all.addAll(homepage2)
@ -127,7 +132,7 @@ class PinoyMoviesEsProvider : MainAPI() {
val document = app.get(url, interceptor = DdosGuardKiller(true))
.document.select("div#archive-content > article")
return document?.mapNotNull {
return document.mapNotNull {
// Fetch details
val urlTitle = it?.select("div.data") ?: return@mapNotNull null
val link = urlTitle.select("a")?.attr("href") ?: return@mapNotNull null