From c62cec150f8b9ab1dc6dcfde0aaaa30eec170173 Mon Sep 17 00:00:00 2001 From: AwkwardPeak7 <48650614+AwkwardPeak7@users.noreply.github.com> Date: Sat, 10 Aug 2024 17:53:17 +0500 Subject: [PATCH] HentaiManga: fix chapter list & search (#4546) --- src/en/hentaimanga/build.gradle | 2 +- .../extension/en/hentaimanga/HentaiManga.kt | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/en/hentaimanga/build.gradle b/src/en/hentaimanga/build.gradle index cb0d142e0..0fe7008e2 100644 --- a/src/en/hentaimanga/build.gradle +++ b/src/en/hentaimanga/build.gradle @@ -3,7 +3,7 @@ ext { extClass = '.HentaiManga' themePkg = 'madara' baseUrl = 'https://hentaimanga.me' - overrideVersionCode = 1 + overrideVersionCode = 2 isNsfw = true } diff --git a/src/en/hentaimanga/src/eu/kanade/tachiyomi/extension/en/hentaimanga/HentaiManga.kt b/src/en/hentaimanga/src/eu/kanade/tachiyomi/extension/en/hentaimanga/HentaiManga.kt index 822546bd2..ff5b2b262 100644 --- a/src/en/hentaimanga/src/eu/kanade/tachiyomi/extension/en/hentaimanga/HentaiManga.kt +++ b/src/en/hentaimanga/src/eu/kanade/tachiyomi/extension/en/hentaimanga/HentaiManga.kt @@ -1,6 +1,11 @@ package eu.kanade.tachiyomi.extension.en.hentaimanga import eu.kanade.tachiyomi.multisrc.madara.Madara +import eu.kanade.tachiyomi.network.POST +import eu.kanade.tachiyomi.source.model.SManga +import okhttp3.FormBody +import okhttp3.Request +import org.jsoup.nodes.Element import java.text.SimpleDateFormat import java.util.Locale @@ -13,4 +18,28 @@ class HentaiManga : Madara( // The website does not flag the content. override val filterNonMangaItems = false + override val useNewChapterEndpoint = false + override val sendViewCount = false + override val fetchGenres = false + override val useLoadMoreRequest = LoadMoreStrategy.Never + + override fun popularMangaNextPageSelector() = "a.next" + override fun searchMangaSelector() = "li.movie-item > a" + override fun searchMangaNextPageSelector() = "a.next" + + override fun searchMangaFromElement(element: Element): SManga { + return SManga.create().apply { + setUrlWithoutDomain(element.absUrl("href")) + title = element.attr("title") + } + } + + override fun oldXhrChaptersRequest(mangaId: String): Request { + val form = FormBody.Builder() + .add("action", "ajax_chap") + .add("post_id", mangaId) + .build() + + return POST("$baseUrl/wp-admin/admin-ajax.php", xhrHeaders, form) + } }