From 7be8a6b24b9403d158bcea8d5a88860f9c91c4de Mon Sep 17 00:00:00 2001 From: Owen <96526481+owencz1998@users.noreply.github.com> Date: Fri, 10 Jan 2025 17:45:08 +0000 Subject: [PATCH] fixes --- .../src/main/kotlin/com/Whoreshub/Whoreshub.kt | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Whoreshub/src/main/kotlin/com/Whoreshub/Whoreshub.kt b/Whoreshub/src/main/kotlin/com/Whoreshub/Whoreshub.kt index c5569b5..6db06ff 100644 --- a/Whoreshub/src/main/kotlin/com/Whoreshub/Whoreshub.kt +++ b/Whoreshub/src/main/kotlin/com/Whoreshub/Whoreshub.kt @@ -39,7 +39,6 @@ class Whoreshub : MainAPI() { "${mainUrl}/categories/deepthroat" to "Deepthroat", "${mainUrl}/categories/fisting" to "Fisting", ) - override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse { val document = app.get("${request.data}/${page}/").document val home = document.select("div.block-thumbs a.item").mapNotNull { it.toSearchResult() } @@ -57,8 +56,8 @@ class Whoreshub : MainAPI() { private fun Element.toSearchResult(): SearchResponse { val title = this.attr("title") val href = this.attr("href") - val posterUrl = fixUrlNull(this.selectFirst("img").attr("data-src")) - + val posterUrl = fixUrlNull(this.selectFirst("img")?.attr("data-src")) + return newMovieSearchResponse(title, href, TvType.Movie) { this.posterUrl = posterUrl } @@ -78,9 +77,9 @@ class Whoreshub : MainAPI() { override suspend fun load(url: String): LoadResponse { val document = app.get(url).document - val title = document.selectFirst("meta[property=og:title]").attr("content") - val posterUrl = fixUrlNull(document.selectFirst("meta[property=og:image]").attr("content")) - + val title = document.selectFirst("meta[property=og:title]")?.attr("content") ?:"" + val posterUrl = fixUrlNull(document.selectFirst("meta[property=og:image]")?.attr("content")) + return newMovieLoadResponse(title, url, TvType.NSFW, url) { this.posterUrl = posterUrl } @@ -95,7 +94,7 @@ class Whoreshub : MainAPI() { val document = app.get(data).document val docText = document.toString() - val regex = Regex("""video_(?:url|alt_url(?:2|3)?): '(https:\/\/[^']+)'""") + val regex = Regex("""video_(?:url|alt_url(?:2|3)?): '(https://[^']+)'""") val links = regex.findAll(docText).map { it.groupValues[1] }.toList() for(link in links) { if(link.isNotEmpty()) { @@ -113,4 +112,4 @@ class Whoreshub : MainAPI() { return true } -} +} \ No newline at end of file