From 02acc7e9d445d33a47672b71d2fee93861a04ab8 Mon Sep 17 00:00:00 2001 From: Draken <131387159+dragonx943@users.noreply.github.com> Date: Mon, 14 Apr 2025 15:46:45 +0700 Subject: [PATCH] [CuuTruyen] Add new SortOrder (#1669) --- .../kotatsu/parsers/site/vi/CuuTruyenParser.kt | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/CuuTruyenParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/CuuTruyenParser.kt index 72853802..2ed06327 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/CuuTruyenParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/CuuTruyenParser.kt @@ -45,6 +45,8 @@ internal class CuuTruyenParser(context: MangaLoaderContext) : SortOrder.UPDATED, SortOrder.POPULARITY, SortOrder.NEWEST, + SortOrder.POPULARITY_WEEK, + SortOrder.POPULARITY_MONTH, ) override val filterCapabilities: MangaListFilterCapabilities @@ -90,13 +92,23 @@ internal class CuuTruyenParser(context: MangaLoaderContext) : append("/api/v2/mangas") when (order) { SortOrder.UPDATED -> append("/recently_updated") - SortOrder.POPULARITY -> append("/top") + SortOrder.POPULARITY -> append("/top?duration=all") + SortOrder.POPULARITY_WEEK -> append("/top?duration=week") + SortOrder.POPULARITY_MONTH -> append("/top?duration=month") SortOrder.NEWEST -> append("/recently_updated") else -> append("/recently_updated") } } - append("?page=") - append(page.toString()) + when (order) { + SortOrder.POPULARITY, SortOrder.POPULARITY_WEEK, SortOrder.POPULARITY_MONTH -> { + append("&page=") + append(page.toString()) + } + else -> { + append("?page=") + append(page.toString()) + } + } } }