From 1c9ae26c1eefeb789b80908e1a700411481d2536 Mon Sep 17 00:00:00 2001 From: KenjieDec <65448230+KenjieDec@users.noreply.github.com> Date: Fri, 26 Jul 2024 15:15:51 +0700 Subject: [PATCH] ManhwaHentaiMe: Fix Chapters Not Found (#4245) * Fix Chapters * LF --- src/en/manhwahentaime/build.gradle | 2 +- .../en/manhwahentaime/ManhwahentaiMe.kt | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/en/manhwahentaime/build.gradle b/src/en/manhwahentaime/build.gradle index 245e430fe..66f309a91 100644 --- a/src/en/manhwahentaime/build.gradle +++ b/src/en/manhwahentaime/build.gradle @@ -3,7 +3,7 @@ ext { extClass = '.ManhwahentaiMe' themePkg = 'madara' baseUrl = 'https://manhwahentai.me' - overrideVersionCode = 3 + overrideVersionCode = 4 isNsfw = true } diff --git a/src/en/manhwahentaime/src/eu/kanade/tachiyomi/extension/en/manhwahentaime/ManhwahentaiMe.kt b/src/en/manhwahentaime/src/eu/kanade/tachiyomi/extension/en/manhwahentaime/ManhwahentaiMe.kt index 273e9e872..36a6cfe0f 100644 --- a/src/en/manhwahentaime/src/eu/kanade/tachiyomi/extension/en/manhwahentaime/ManhwahentaiMe.kt +++ b/src/en/manhwahentaime/src/eu/kanade/tachiyomi/extension/en/manhwahentaime/ManhwahentaiMe.kt @@ -1,10 +1,35 @@ package eu.kanade.tachiyomi.extension.en.manhwahentaime import eu.kanade.tachiyomi.multisrc.madara.Madara +import eu.kanade.tachiyomi.network.POST +import eu.kanade.tachiyomi.source.model.SChapter +import eu.kanade.tachiyomi.util.asJsoup +import okhttp3.FormBody +import okhttp3.Response class ManhwahentaiMe : Madara("Manhwahentai.me", "https://manhwahentai.me", "en") { override val useNewChapterEndpoint: Boolean = true override val mangaSubString = "webtoon" + + override fun chapterListParse(response: Response): List { + val document = response.asJsoup() + + launchIO { countViews(document) } + + val comicObj = document.selectFirst("script:containsData(comicObj)")!!.data() + val id = comicObj.filter { it.isDigit() } + val name = comicObj.substringBefore(":").substringAfter("{").trim() + val ajax_url = document.selectFirst("script:containsData(ajax)")!!.data().substringAfter('"').substringBefore('"') + + val body = FormBody.Builder() + .add(name, id) + .add("action", "ajax_chap") + .build() + val doc = client.newCall(POST(ajax_url, headers, body)).execute().asJsoup() + val chapterElements = doc.select(chapterListSelector()) + + return chapterElements.map(::chapterFromElement) + } }