Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
owencz1998 authored Jan 10, 2025
1 parent a2294c7 commit 7be8a6b
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions Whoreshub/src/main/kotlin/com/Whoreshub/Whoreshub.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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() }
Expand All @@ -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
}
Expand All @@ -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
}
Expand All @@ -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()) {
Expand All @@ -113,4 +112,4 @@ class Whoreshub : MainAPI() {

return true
}
}
}

0 comments on commit 7be8a6b

Please sign in to comment.