[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" language = "tl"
// All of these properties are optional, you can safely remove them // All of these properties are optional, you can safely remove them
// description = "Lorem Ipsum" description = "Pinoy HD Movies - High Definition"
// authors = listOf("Cloudburst") authors = listOf("Jace")
/** /**
* Status int as the following: * Status int as the following:

View File

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

View File

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

View File

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