From a30277322aac5671027caaa47146f68ae5ac6cf9 Mon Sep 17 00:00:00 2001 From: Jace <54625750+Jacekun@users.noreply.github.com> Date: Tue, 30 Aug 2022 22:13:46 +0800 Subject: [PATCH] [Feature] Enable nsfw on Pinoy movie providers homepage (#7) --- PinoyHDXyzProvider/build.gradle.kts | 4 ++-- PinoyMovies/build.gradle.kts | 4 ++-- .../com/lagradost/PinoyMoviePediaProvider.kt | 8 ++++--- .../com/lagradost/PinoyMoviesEsProvider.kt | 21 ++++++++++++------- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/PinoyHDXyzProvider/build.gradle.kts b/PinoyHDXyzProvider/build.gradle.kts index 077ec3b..714133d 100644 --- a/PinoyHDXyzProvider/build.gradle.kts +++ b/PinoyHDXyzProvider/build.gradle.kts @@ -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: diff --git a/PinoyMovies/build.gradle.kts b/PinoyMovies/build.gradle.kts index 9e087e9..0e2c4a2 100644 --- a/PinoyMovies/build.gradle.kts +++ b/PinoyMovies/build.gradle.kts @@ -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: diff --git a/PinoyMovies/src/main/kotlin/com/lagradost/PinoyMoviePediaProvider.kt b/PinoyMovies/src/main/kotlin/com/lagradost/PinoyMoviePediaProvider.kt index 8448701..33e0a30 100644 --- a/PinoyMovies/src/main/kotlin/com/lagradost/PinoyMoviePediaProvider.kt +++ b/PinoyMovies/src/main/kotlin/com/lagradost/PinoyMoviePediaProvider.kt @@ -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> = 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") diff --git a/PinoyMovies/src/main/kotlin/com/lagradost/PinoyMoviesEsProvider.kt b/PinoyMovies/src/main/kotlin/com/lagradost/PinoyMoviesEsProvider.kt index f614269..5b7ad69 100644 --- a/PinoyMovies/src/main/kotlin/com/lagradost/PinoyMoviesEsProvider.kt +++ b/PinoyMovies/src/main/kotlin/com/lagradost/PinoyMoviesEsProvider.kt @@ -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