From fe64620e9fa4e473d9cd69238dc820a2938cdc19 Mon Sep 17 00:00:00 2001 From: vianh Date: Sun, 23 Jul 2023 15:00:36 +0700 Subject: [PATCH] [HentaiVN] Load pages using api --- .../koitharu/kotatsu/parsers/site/vi/HentaiVNParser.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/HentaiVNParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/HentaiVNParser.kt index 07156c8d..4be4a321 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/HentaiVNParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/vi/HentaiVNParser.kt @@ -136,8 +136,12 @@ class HentaiVNParser(context: MangaLoaderContext) : MangaParser(context, MangaSo } override suspend fun getPages(chapter: MangaChapter): List { - val docs = webClient.httpGet(chapter.url.toAbsoluteUrl(domain)).parseHtml() - return docs.requireElementById("image").select("img").map { + val ids = chapter.url.removePrefix("/").split('-').take(2) + val mangaId = ids[0].toInt() + val chapterId = ids[1].toInt() + val contentUrl = "/list-loadchapter.php?id_episode=$chapterId&idchapshowz=$mangaId".toAbsoluteUrl(domain) + val docs = webClient.httpGet(contentUrl).parseHtml() + return docs.select("img").map { val pageUrl = it.attrAsAbsoluteUrl("src") MangaPage( id = generateUid(pageUrl),