mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
cherry pick some MAL fixes (#1364)
* fix MAL search novel filter (#6279) * Truncate MAL search queries to first 64 characters (closes #6314) Is it worth telling the user? ¯\_(ツ)_/¯ Co-authored-by: arkon <eugcheung94@gmail.com>
This commit is contained in:
parent
0e70a4c405
commit
d1aa032008
1 changed files with 3 additions and 2 deletions
|
@ -64,7 +64,8 @@ class MyAnimeListApi(private val client: OkHttpClient, interceptor: MyAnimeListI
|
|||
suspend fun search(query: String): List<TrackSearch> {
|
||||
return withIOContext {
|
||||
val url = "$baseApiUrl/manga".toUri().buildUpon()
|
||||
.appendQueryParameter("q", query)
|
||||
// MAL API throws a 400 when the query is over 64 characters...
|
||||
.appendQueryParameter("q", query.take(64))
|
||||
.appendQueryParameter("nsfw", "true")
|
||||
.build()
|
||||
authClient.newCall(GET(url.toString()))
|
||||
|
@ -78,7 +79,7 @@ class MyAnimeListApi(private val client: OkHttpClient, interceptor: MyAnimeListI
|
|||
async { getMangaDetails(id) }
|
||||
}
|
||||
.awaitAll()
|
||||
.filter { trackSearch -> trackSearch.publishing_type != "novel" }
|
||||
.filter { trackSearch -> !trackSearch.publishing_type.contains("novel") }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue