From 139a589ad61f359ddace8e068649e92ed498903e Mon Sep 17 00:00:00 2001 From: arkon Date: Thu, 31 Dec 2020 10:58:40 -0500 Subject: [PATCH] Increase per-page limit when searching MAL manga list --- .../tachiyomi/data/track/myanimelist/MyAnimeListApi.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListApi.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListApi.kt index 2d5fe38961..77b5411d3c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListApi.kt @@ -167,7 +167,7 @@ class MyAnimeListApi(private val client: OkHttpClient, interceptor: MyAnimeListI return withContext(Dispatchers.IO) { val urlBuilder = "$baseApiUrl/users/@me/mangalist".toUri().buildUpon() .appendQueryParameter("fields", "list_status") - .appendQueryParameter("limit", "25") + .appendQueryParameter("limit", listPaginationAmount.toString()) if (offset > 0) { urlBuilder.appendQueryParameter("offset", offset.toString()) } @@ -192,7 +192,7 @@ class MyAnimeListApi(private val client: OkHttpClient, interceptor: MyAnimeListI } // Check next page if there's more !obj["paging"]!!.jsonObject["next"]?.jsonPrimitive?.contentOrNull.isNullOrBlank() -> { - findListItem(track, offset + 25) + findListItem(track, offset + listPaginationAmount) } // No more pages to check, item wasn't found else -> { @@ -220,6 +220,8 @@ class MyAnimeListApi(private val client: OkHttpClient, interceptor: MyAnimeListI private const val baseOAuthUrl = "https://myanimelist.net/v1/oauth2" private const val baseApiUrl = "https://api.myanimelist.net/v2" + private const val listPaginationAmount = 250 + private var codeVerifier: String = "" fun authUrl(): Uri = "$baseOAuthUrl/authorize".toUri().buildUpon()