improved Paradisehill searchResults

This commit is contained in:
hexated 2022-10-16 11:04:59 +07:00
parent f35f06f176
commit 3a657f880d
4 changed files with 30 additions and 16 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 4 version = 5
cloudstream { cloudstream {

View file

@ -31,9 +31,11 @@ class GoodPorn : MainAPI() {
request: MainPageRequest request: MainPageRequest
): HomePageResponse { ): HomePageResponse {
val document = app.get(request.data + page).document val document = app.get(request.data + page).document
val home = document.select("div#list_videos_most_recent_videos_items div.item, div#list_videos_common_videos_list_items div.item").mapNotNull { val home =
it.toSearchResult() document.select("div#list_videos_most_recent_videos_items div.item, div#list_videos_common_videos_list_items div.item")
} .mapNotNull {
it.toSearchResult()
}
return newHomePageResponse( return newHomePageResponse(
list = HomePageList( list = HomePageList(
name = request.name, name = request.name,
@ -56,16 +58,19 @@ class GoodPorn : MainAPI() {
override suspend fun search(query: String): List<SearchResponse> { override suspend fun search(query: String): List<SearchResponse> {
val searchResponse = mutableListOf<SearchResponse>() val searchResponse = mutableListOf<SearchResponse>()
for (i in 1..10) { for (i in 1..15) {
val document = val document =
app.get( app.get(
"$mainUrl/search/nikki-benz/?mode=async&function=get_block&block_id=list_videos_videos_list_search_result&q=$query&category_ids=&sort_by=&from_videos=$i&from_albums=$i", "$mainUrl/search/nikki-benz/?mode=async&function=get_block&block_id=list_videos_videos_list_search_result&q=$query&category_ids=&sort_by=&from_videos=$i&from_albums=$i",
headers = mapOf("X-Requested-With" to "XMLHttpRequest") headers = mapOf("X-Requested-With" to "XMLHttpRequest")
).document ).document
searchResponse.addAll(document.select("div#list_videos_videos_list_search_result_items div.item") val results =
.mapNotNull { document.select("div#list_videos_videos_list_search_result_items div.item")
it.toSearchResult() .mapNotNull {
}) it.toSearchResult()
}
searchResponse.addAll(results)
if (results.isEmpty()) break
} }
return searchResponse return searchResponse
} }
@ -106,7 +111,8 @@ class GoodPorn : MainAPI() {
ExtractorLink( ExtractorLink(
this.name, this.name,
this.name, this.name,
res.attr("href").replace(Regex("\\?download\\S+.mp4&"), "?") + "&rnd=${Date().time}" , res.attr("href")
.replace(Regex("\\?download\\S+.mp4&"), "?") + "&rnd=${Date().time}",
referer = data, referer = data,
quality = Regex("([0-9]+p),").find(res.text())?.groupValues?.get(1) quality = Regex("([0-9]+p),").find(res.text())?.groupValues?.get(1)
.let { getQualityFromName(it) }, .let { getQualityFromName(it) },

View file

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 2 version = 3
cloudstream { cloudstream {

View file

@ -10,6 +10,7 @@ class Paradisehill : MainAPI() {
override var name = "Paradisehill" override var name = "Paradisehill"
override val hasMainPage = true override val hasMainPage = true
override val hasDownloadSupport = true override val hasDownloadSupport = true
override var sequentialMainPage = true
override val vpnStatus = VPNStatus.MightBeNeeded override val vpnStatus = VPNStatus.MightBeNeeded
override val supportedTypes = setOf(TvType.NSFW) override val supportedTypes = setOf(TvType.NSFW)
@ -48,11 +49,18 @@ class Paradisehill : MainAPI() {
} }
override suspend fun search(query: String): List<SearchResponse> { override suspend fun search(query: String): List<SearchResponse> {
val document = app.get("$mainUrl/search/?pattern=$query&what=1").document val searchResponse = mutableListOf<SearchResponse>()
return document.select("div.content div.item") for (i in 1..10) {
.mapNotNull { val document = app.get("$mainUrl/search/?pattern=$query&what=1&page=$i").document
it.toSearchResult() val results = document.select("div.content div.item")
} .mapNotNull {
it.toSearchResult()
}
searchResponse.addAll(results)
if(results.isEmpty()) break
}
return searchResponse
} }
override suspend fun load(url: String): LoadResponse? { override suspend fun load(url: String): LoadResponse? {