From 224c8a6c533b0c758d230fb5acdf77ef72e6dc78 Mon Sep 17 00:00:00 2001 From: Draken Date: Tue, 11 Mar 2025 02:43:17 +0000 Subject: [PATCH 1/2] [Kumapage] Fixes + Tweak --- .../kotatsu/parsers/site/id/Kumapage.kt | 35 ++++++++++++------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/id/Kumapage.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/id/Kumapage.kt index 3acffa8d..aad99744 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/id/Kumapage.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/id/Kumapage.kt @@ -12,6 +12,8 @@ import org.koitharu.kotatsu.parsers.util.* import java.text.SimpleDateFormat import java.util.* +// TODO: Check if manga is NSFW by checking the genre + @MangaSourceParser("KUMAPAGE", "Kumapage", "id") internal class Kumapage(context: MangaLoaderContext) : LegacyPagedMangaParser(context, MangaParserSource.KUMAPAGE, 14) { @@ -116,7 +118,6 @@ internal class Kumapage(context: MangaLoaderContext) : rating = RATING_UNKNOWN, state = null, coverUrl = img, - // TODO: Check if manga is NSFW by checking the genre contentRating = if (isNsfwSource) ContentRating.ADULT else null, source = source, ) @@ -166,21 +167,29 @@ internal class Kumapage(context: MangaLoaderContext) : val doc = webClient.httpGet(chapter.url.toAbsoluteUrl(domain)).parseHtml() return doc.select("div.content_place img").mapNotNull { img -> val url = img.attr("src") - MangaPage( - id = generateUid(url), - url = url, - preview = null, - source = source, - ) + if (!img.hasClass("ui") && !img.hasClass("avatar") && !img.hasClass("image")) { + MangaPage( + id = generateUid(url), + url = url, + preview = null, + source = source, + ) + } else { + null + } } } private suspend fun fetchTags(): Set { val doc = webClient.httpGet("https://$domain/search").parseHtml() - return doc.select("select#genre option").map { option -> - val key = option.attr("value") - val title = option.text() - MangaTag(title = title, key = key, source = source) - }.toSet() - } + return doc.select("select#genre option").mapNotNull { option -> + val key = option.attr("value") + val title = option.text() + if (title != "All Genres") { // remove "all" tags to avoid "Nothing found" + MangaTag(title = title, key = key, source = source) + } else { + null + } + }.toSet() + } } \ No newline at end of file From f806cdd118e2adf1e675465aafb0b916fe491a04 Mon Sep 17 00:00:00 2001 From: Draken Date: Tue, 11 Mar 2025 02:48:22 +0000 Subject: [PATCH 2/2] [Kumapage] Fixes + Tweak --- .../kotlin/org/koitharu/kotatsu/parsers/site/id/Kumapage.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/id/Kumapage.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/id/Kumapage.kt index aad99744..1283c327 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/id/Kumapage.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/id/Kumapage.kt @@ -140,6 +140,9 @@ internal class Kumapage(context: MangaLoaderContext) : MangaTag(title = tag.text(), key = "", source = source) }.toSet() + val checkTags = setOf("Adult", "Ecchi", "Hentai", "Incest", "Josei(W)", "Loli", "Netorare", "Smut", "Violence") + val contentRating = if (tags.any { it.title in checkTags }) ContentRating.ADULT else null + val chapters = doc.select("tbody#result-comic tr").mapIndexed { i, row -> MangaChapter( id = generateUid(row.select("td:nth-child(4) a").attr("href")), @@ -159,6 +162,7 @@ internal class Kumapage(context: MangaLoaderContext) : description = description, state = state, tags = tags, + contentRating = contentRating, chapters = chapters, ) }