From d3858ff5ff913500e7f6c284a70fff62df1ec603 Mon Sep 17 00:00:00 2001 From: Draken Date: Tue, 11 Feb 2025 17:41:18 +0000 Subject: [PATCH] [Hentai18VN] Fix attempt 2 --- .../kotatsu/parsers/site/vi/Hentai18VN.kt | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/Hentai18VN.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/Hentai18VN.kt index a5e533b7..16123a83 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/Hentai18VN.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/Hentai18VN.kt @@ -47,17 +47,12 @@ internal class Hentai18VN(context: MangaLoaderContext) : PagedMangaParser(contex if (page > 1) { return emptyList() } - val url = buildString { - append("http://") - append(domain) - append("/search/html/1") - }.toHttpUrl() - val body = JSONObject().apply { - put("keyword", filter.query) - } - + + val keyword = filter.query + // val body = JSONObject().apply { put("keyword", filter.query) } + val url = "$domain/search/html/1".toHttpUrl() val headers = Headers.Builder().add("X-Requested-With", "XMLHttpRequest").build() - val response = webClient.httpPost(url, body, headers).parseHtml() + val response = webClient.httpPost(url, payload = "keyword=$keyword", headers).parseHtml() parseMangaSearch(response) } @@ -222,11 +217,7 @@ internal class Hentai18VN(context: MangaLoaderContext) : PagedMangaParser(contex val a = li.selectFirst("a") ?: return@mapNotNull null val title = a.selectFirst("h3.tag-name")?.text()?.trim() ?: return@mapNotNull null val url = a.attr("href") - MangaTag( - title = title, - key = url.substringAfterLast("/"), - source = source - ) + MangaTag( title = title, key = url.substringAfterLast("/"), source = source ) } }.toSet() }