Skip to content

Commit

Permalink
uaflix: Implement search
Browse files Browse the repository at this point in the history
  • Loading branch information
CakesTwix committed Jul 30, 2024
1 parent cc02559 commit b85fdc5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion UAFlixProvider/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// use an integer for version numbers
version = 1
version = 2

dependencies {
implementation("com.google.code.gson:gson:2.9.0")
Expand Down
17 changes: 6 additions & 11 deletions UAFlixProvider/src/main/kotlin/com/lagradost/UAFlixProvider.kt
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ class UAFlixProvider : MainAPI() {
}

private fun Element.toSearchResponse(): AnimeSearchResponse {
val title = this.selectFirst(titleSelector)?.attr("alt")?.trim().toString()
val title = this.selectFirst("$titleSelector,.sres-wrap")?.attr("alt")?.trim().toString()
// val engTitle = this.selectFirst(engTitleSelector)?.text()?.trim().toString()
val href = this.selectFirst(hrefSelector)?.attr("href").toString()
val posterUrl = fixUrl(this.select(posterSelector).attr("src"))
val href = this.selectFirst("$hrefSelector,.sres-wrap")?.attr("href").toString()
val posterUrl = fixUrl(this.select("$posterSelector,.sres-img img").attr("src"))

return newAnimeSearchResponse(title, href, TvType.Anime) {
// this.otherName = engTitle
Expand All @@ -95,16 +95,11 @@ class UAFlixProvider : MainAPI() {
}

override suspend fun search(query: String): List<SearchResponse> {
val document = app.post(
url = mainUrl,
data = mapOf(
"do" to "search",
"subaction" to "search",
"story" to query.replace(" ", "+")
)
val document = app.get(
url = "$mainUrl/index.php?do=search&subaction=search&search_start=1&story=$query",
).document

return document.select(animeSelector).map {
return document.select(".sres-wrap").map {
it.toSearchResponse()
}
}
Expand Down

0 comments on commit b85fdc5

Please sign in to comment.