From 47e03e584cd6230217246198acef3dbb6bef4054 Mon Sep 17 00:00:00 2001 From: AwkwardPeak7 <48650614+AwkwardPeak7@users.noreply.github.com> Date: Fri, 9 Aug 2024 10:31:27 +0500 Subject: [PATCH] InstaManhwa: fix (#4511) --- src/en/instamanhwa/build.gradle | 2 +- .../extension/en/instamanhwa/InstaManhwa.kt | 61 +------------------ 2 files changed, 3 insertions(+), 60 deletions(-) diff --git a/src/en/instamanhwa/build.gradle b/src/en/instamanhwa/build.gradle index 4ab1b815d..0df673155 100644 --- a/src/en/instamanhwa/build.gradle +++ b/src/en/instamanhwa/build.gradle @@ -3,7 +3,7 @@ ext { extClass = '.InstaManhwa' themePkg = 'madara' baseUrl = 'https://www.instamanhwa.com' - overrideVersionCode = 1 + overrideVersionCode = 2 isNsfw = true } diff --git a/src/en/instamanhwa/src/eu/kanade/tachiyomi/extension/en/instamanhwa/InstaManhwa.kt b/src/en/instamanhwa/src/eu/kanade/tachiyomi/extension/en/instamanhwa/InstaManhwa.kt index a9986acc2..3d2e7eeb4 100644 --- a/src/en/instamanhwa/src/eu/kanade/tachiyomi/extension/en/instamanhwa/InstaManhwa.kt +++ b/src/en/instamanhwa/src/eu/kanade/tachiyomi/extension/en/instamanhwa/InstaManhwa.kt @@ -1,69 +1,12 @@ package eu.kanade.tachiyomi.extension.en.instamanhwa import eu.kanade.tachiyomi.multisrc.madara.Madara -import eu.kanade.tachiyomi.network.GET -import eu.kanade.tachiyomi.network.POST -import eu.kanade.tachiyomi.source.model.FilterList -import eu.kanade.tachiyomi.source.model.Page -import eu.kanade.tachiyomi.source.model.SChapter -import eu.kanade.tachiyomi.source.model.SManga -import eu.kanade.tachiyomi.util.asJsoup -import okhttp3.FormBody -import okhttp3.Request -import okhttp3.Response -import org.jsoup.nodes.Document -import java.text.SimpleDateFormat -import java.util.Locale class InstaManhwa : Madara( "InstaManhwa", "https://www.instamanhwa.com", "en", - SimpleDateFormat("dd MMMM, yyyy", Locale.US), ) { - - override val supportsLatest: Boolean = false - override val fetchGenres = false - - override fun latestUpdatesRequest(page: Int): Request = GET("$baseUrl/latest?page=$page", headers) - - override fun popularMangaRequest(page: Int): Request = latestUpdatesRequest(page) - - override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { - return GET("$baseUrl/search?s=$query&page=$page", headers) - } - - override fun pageListParse(document: Document): List { - return super.pageListParse(document).distinctBy { it.imageUrl } - } - - override fun chapterListRequest(manga: SManga): Request { - return GET("$baseUrl${manga.url}") - } - - override fun chapterListParse(response: Response): List { - val document = response.asJsoup() - val mangaId = document.select("div[id^=manga-chapters-holder]").attr("data-id") - val cookie = response.headers("").joinToString { it.substringBefore(";") } - val token = document.select("meta[name=csrf-token]").attr("content") - return getAjaxChapters(mangaId, cookie, token) - .select(chapterListSelector()) - .map { chapterFromElement(it) } - } - - private fun getAjaxChapters(mangaId: String, cookie: String, token: String): Document { - val headers = headersBuilder() - .add("Host", baseUrl.substringAfter("https://")) - .add("Cookie", cookie) - .build() - val body = FormBody.Builder() - .addEncoded("_token", token) - .addEncoded("action", "manga_get_chapters") - .addEncoded("manga", mangaId) - .build() - return client.newCall(POST("$baseUrl/ajax", headers, body)).execute().asJsoup() - } - - // Not used - override fun getFilterList(): FilterList = FilterList() + override val filterNonMangaItems = false + override val useNewChapterEndpoint = true }