From ba5086c4093a46e2794266af1d810b440cee220b Mon Sep 17 00:00:00 2001 From: shub39 Date: Mon, 3 Mar 2025 09:21:55 +0530 Subject: [PATCH 1/3] :hammer: Mangakakalot fix * issue #1522 * passing 5 out of 11 tests --- .../kotatsu/parsers/site/mangabox/en/Mangakakalot.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangabox/en/Mangakakalot.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangabox/en/Mangakakalot.kt index f510ae50..1c76c7cb 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangabox/en/Mangakakalot.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangabox/en/Mangakakalot.kt @@ -17,10 +17,10 @@ import org.koitharu.kotatsu.parsers.util.* import java.text.SimpleDateFormat import java.util.* -@MangaSourceParser("MANGAKAKALOT", "Mangakakalot.com", "en") +@MangaSourceParser("MANGAKAKALOT", "Mangakakalot.gg", "en") internal class Mangakakalot(context: MangaLoaderContext) : MangaboxParser(context, MangaParserSource.MANGAKAKALOT) { - override val configKeyDomain = ConfigKey.Domain("mangakakalot.com", "chapmanganato.com") + override val configKeyDomain = ConfigKey.Domain("mangakakalot.gg", "chapmanganato.com") override val availableSortOrders: Set = EnumSet.of( SortOrder.UPDATED, SortOrder.POPULARITY, @@ -48,7 +48,7 @@ internal class Mangakakalot(context: MangaLoaderContext) : ) override val otherDomain = "chapmanganato.com" - override val listUrl = "/manga_list" + override val listUrl = "/genre/all" private fun SearchableField.toParamName(): String = when (this) { TAG -> "category" @@ -96,7 +96,7 @@ internal class Mangakakalot(context: MangaLoaderContext) : var titleSearchUrl: String? = null val url = buildString { val pageQueryParameter = "page=$page" - append("https://$domain/?") + append("https://$domain/genre/all?") query.criteria.forEach { criterion -> when (criterion) { @@ -150,7 +150,7 @@ internal class Mangakakalot(context: MangaLoaderContext) : } override suspend fun fetchAvailableTags(): Set { - val doc = webClient.httpGet("https://$domain/$listUrl").parseHtml() + val doc = webClient.httpGet("https://$domain").parseHtml() val tags = doc.select("ul.tag li a").drop(1) return tags.mapToSet { a -> val key = a.attr("href").substringAfterLast("category=").substringBefore("&") From 41f5cee6c6da29bb17f7d43533a68caaed64580a Mon Sep 17 00:00:00 2001 From: shub39 Date: Mon, 3 Mar 2025 11:02:26 +0530 Subject: [PATCH 2/3] :zap: New way to get tags --- .../parsers/site/mangabox/en/Mangakakalot.kt | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangabox/en/Mangakakalot.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangabox/en/Mangakakalot.kt index 1c76c7cb..b0c30a72 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangabox/en/Mangakakalot.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangabox/en/Mangakakalot.kt @@ -143,6 +143,7 @@ internal class Mangakakalot(context: MangaLoaderContext) : tags = emptySet(), authors = emptySet(), state = null, + description = div.selectFirst("h2")?.text() ?: "No Description", source = source, contentRating = null, ) @@ -151,16 +152,23 @@ internal class Mangakakalot(context: MangaLoaderContext) : override suspend fun fetchAvailableTags(): Set { val doc = webClient.httpGet("https://$domain").parseHtml() - val tags = doc.select("ul.tag li a").drop(1) - return tags.mapToSet { a -> - val key = a.attr("href").substringAfterLast("category=").substringBefore("&") - val name = a.attr("title").replace(" Manga", "") - MangaTag( - key = key, - title = name, - source = source, - ) + val tags = doc.select("td a[href*='/genre/']").drop(1) + val uniqueTags = mutableSetOf() + for (a in tags) { + val key = a.attr("href").substringAfter("/genre/").substringBefore("?") + val name = a.text().replaceFirstChar { it.uppercaseChar() } + if (uniqueTags.none { it.key == key }) { + uniqueTags.add( + MangaTag( + key = key, + title = name, + source = source, + ) + ) + } } + + return uniqueTags } override suspend fun getChapters(doc: Document): List { From 7ced91beead908025b6a6b605619c96f79578286 Mon Sep 17 00:00:00 2001 From: shub39 Date: Mon, 3 Mar 2025 12:24:34 +0530 Subject: [PATCH 3/3] :wrench: no description --- .../koitharu/kotatsu/parsers/site/mangabox/en/Mangakakalot.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangabox/en/Mangakakalot.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangabox/en/Mangakakalot.kt index b0c30a72..0dce0423 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangabox/en/Mangakakalot.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/mangabox/en/Mangakakalot.kt @@ -143,7 +143,6 @@ internal class Mangakakalot(context: MangaLoaderContext) : tags = emptySet(), authors = emptySet(), state = null, - description = div.selectFirst("h2")?.text() ?: "No Description", source = source, contentRating = null, )