uaflix: Implement search

This commit is contained in:
CakesTwix 2024-07-30 16:36:09 +03:00
parent cc025599be
commit b85fdc5da4
Signed by: CakesTwix
GPG key ID: 7B11051D5CE19825
2 changed files with 7 additions and 12 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers
version = 1
version = 2
dependencies {
implementation("com.google.code.gson:gson:2.9.0")

View file

@ -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
@ -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()
}
}