From d3c32faf016ef8fb0d751e62ef6c450842de5643 Mon Sep 17 00:00:00 2001 From: devi Date: Sun, 8 Oct 2023 18:38:32 +0200 Subject: [PATCH] Tag reduction on hentaifox --- .../org/koitharu/kotatsu/parsers/site/all/HentaiFox.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/HentaiFox.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/HentaiFox.kt index e6a766c4..c8675745 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/HentaiFox.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/all/HentaiFox.kt @@ -76,23 +76,23 @@ internal class HentaiFox(context: MangaLoaderContext) : PagedMangaParser(context } } + //Tags are deliberately reduced because there are too many and this slows down the application. + //only the most popular ones are taken. override suspend fun getTags(): Set { - val root = webClient.httpGet("https://$domain/tags/").parseHtml() - val totalPagesTags = root.select("ul.pagination a.page-link").dropLast(1).last().text().toInt() return coroutineScope { - (1..totalPagesTags).map { page -> + (1..3).map { page -> async { getTags(page) } } }.awaitAll().flattenTo(ArraySet(360)) } private suspend fun getTags(page: Int): Set { - val url = "https://$domain/tags/pag/$page/" + val url = "https://$domain/tags/popular/pag/$page/" val root = webClient.httpGet(url).parseHtml() return root.parseTags() } - private fun Element.parseTags() = select(".list_tags a.tag_btn").mapToSet { it -> + private fun Element.parseTags() = select(".list_tags a.tag_btn").mapToSet { val key = it.attr("href").removeSuffix('/').substringAfterLast('/') MangaTag( key = key,