From a4cc989c8ffa77d2609157cad4a423c51d60844b Mon Sep 17 00:00:00 2001 From: AwkwardPeak7 <48650614+AwkwardPeak7@users.noreply.github.com> Date: Sun, 20 Aug 2023 20:23:20 +0500 Subject: [PATCH] Babel Wuxia (#17610) * Babel Wuxia: move to Madara * versionid --- .../res/mipmap-hdpi/ic_launcher.png | Bin .../res/mipmap-mdpi/ic_launcher.png | Bin .../res/mipmap-xhdpi/ic_launcher.png | Bin .../res/mipmap-xxhdpi/ic_launcher.png | Bin .../res/mipmap-xxxhdpi/ic_launcher.png | Bin .../babelwuxia/res/web_hi_res_512.png | Bin .../madara/babelwuxia/src/BabelWuxia.kt | 56 ++++++++++++++++++ .../multisrc/madara/MadaraGenerator.kt | 1 + .../mangathemesia/MangaThemesiaGenerator.kt | 1 - 9 files changed, 57 insertions(+), 1 deletion(-) rename multisrc/overrides/{mangathemesia => madara}/babelwuxia/res/mipmap-hdpi/ic_launcher.png (100%) rename multisrc/overrides/{mangathemesia => madara}/babelwuxia/res/mipmap-mdpi/ic_launcher.png (100%) rename multisrc/overrides/{mangathemesia => madara}/babelwuxia/res/mipmap-xhdpi/ic_launcher.png (100%) rename multisrc/overrides/{mangathemesia => madara}/babelwuxia/res/mipmap-xxhdpi/ic_launcher.png (100%) rename multisrc/overrides/{mangathemesia => madara}/babelwuxia/res/mipmap-xxxhdpi/ic_launcher.png (100%) rename multisrc/overrides/{mangathemesia => madara}/babelwuxia/res/web_hi_res_512.png (100%) create mode 100644 multisrc/overrides/madara/babelwuxia/src/BabelWuxia.kt diff --git a/multisrc/overrides/mangathemesia/babelwuxia/res/mipmap-hdpi/ic_launcher.png b/multisrc/overrides/madara/babelwuxia/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from multisrc/overrides/mangathemesia/babelwuxia/res/mipmap-hdpi/ic_launcher.png rename to multisrc/overrides/madara/babelwuxia/res/mipmap-hdpi/ic_launcher.png diff --git a/multisrc/overrides/mangathemesia/babelwuxia/res/mipmap-mdpi/ic_launcher.png b/multisrc/overrides/madara/babelwuxia/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from multisrc/overrides/mangathemesia/babelwuxia/res/mipmap-mdpi/ic_launcher.png rename to multisrc/overrides/madara/babelwuxia/res/mipmap-mdpi/ic_launcher.png diff --git a/multisrc/overrides/mangathemesia/babelwuxia/res/mipmap-xhdpi/ic_launcher.png b/multisrc/overrides/madara/babelwuxia/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from multisrc/overrides/mangathemesia/babelwuxia/res/mipmap-xhdpi/ic_launcher.png rename to multisrc/overrides/madara/babelwuxia/res/mipmap-xhdpi/ic_launcher.png diff --git a/multisrc/overrides/mangathemesia/babelwuxia/res/mipmap-xxhdpi/ic_launcher.png b/multisrc/overrides/madara/babelwuxia/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from multisrc/overrides/mangathemesia/babelwuxia/res/mipmap-xxhdpi/ic_launcher.png rename to multisrc/overrides/madara/babelwuxia/res/mipmap-xxhdpi/ic_launcher.png diff --git a/multisrc/overrides/mangathemesia/babelwuxia/res/mipmap-xxxhdpi/ic_launcher.png b/multisrc/overrides/madara/babelwuxia/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from multisrc/overrides/mangathemesia/babelwuxia/res/mipmap-xxxhdpi/ic_launcher.png rename to multisrc/overrides/madara/babelwuxia/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/multisrc/overrides/mangathemesia/babelwuxia/res/web_hi_res_512.png b/multisrc/overrides/madara/babelwuxia/res/web_hi_res_512.png similarity index 100% rename from multisrc/overrides/mangathemesia/babelwuxia/res/web_hi_res_512.png rename to multisrc/overrides/madara/babelwuxia/res/web_hi_res_512.png diff --git a/multisrc/overrides/madara/babelwuxia/src/BabelWuxia.kt b/multisrc/overrides/madara/babelwuxia/src/BabelWuxia.kt new file mode 100644 index 000000000..94c385984 --- /dev/null +++ b/multisrc/overrides/madara/babelwuxia/src/BabelWuxia.kt @@ -0,0 +1,56 @@ +package eu.kanade.tachiyomi.extension.en.babelwuxia + +import eu.kanade.tachiyomi.multisrc.madara.Madara +import eu.kanade.tachiyomi.network.POST +import okhttp3.FormBody +import okhttp3.Request + +class BabelWuxia : Madara("Babel Wuxia", "https://read.babelwuxia.com", "en") { + + // moved from MangaThemesia + override val versionId = 2 + + override val useNewChapterEndpoint = true + + override fun popularMangaNextPageSelector() = "body:not(:has(.no-posts))" + + private fun madaraLoadMoreRequest(page: Int, metaKey: String): Request { + val formBody = FormBody.Builder().apply { + add("action", "madara_load_more") + add("page", page.toString()) + add("template", "madara-core/content/content-archive") + add("vars[paged]", "1") + add("vars[orderby]", "meta_value_num") + add("vars[template]", "archive") + add("vars[sidebar]", "right") + add("vars[post_type]", "wp-manga") + add("vars[post_status]", "publish") + add("vars[meta_key]", metaKey) + add("vars[meta_query][0][paged]", "1") + add("vars[meta_query][0][orderby]", "meta_value_num") + add("vars[meta_query][0][template]", "archive") + add("vars[meta_query][0][sidebar]", "right") + add("vars[meta_query][0][post_type]", "wp-manga") + add("vars[meta_query][0][post_status]", "publish") + add("vars[meta_query][0][meta_key]", metaKey) + add("vars[meta_query][relation]", "AND") + add("vars[manga_archives_item_layout]", "default") + }.build() + + val xhrHeaders = headersBuilder() + .add("Content-Length", formBody.contentLength().toString()) + .add("Content-Type", formBody.contentType().toString()) + .add("X-Requested-With", "XMLHttpRequest") + .build() + + return POST("$baseUrl/wp-admin/admin-ajax.php", xhrHeaders, formBody) + } + + override fun popularMangaRequest(page: Int): Request { + return madaraLoadMoreRequest(page - 1, "_wp_manga_views") + } + + override fun latestUpdatesRequest(page: Int): Request { + return madaraLoadMoreRequest(page - 1, "_latest_update") + } +} diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt index 09198956e..b1cc04a0e 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt @@ -52,6 +52,7 @@ class MadaraGenerator : ThemeSourceGenerator { SingleLang("Atikrost", "https://atikrost.com", "tr", overrideVersionCode = 1), SingleLang("AZManhwa", "https://azmanhwa.net", "en"), SingleLang("Azora", "https://azoranov.com", "ar", overrideVersionCode = 6), + SingleLang("Babel Wuxia", "https://read.babelwuxia.com", "en"), SingleLang("Bakaman", "https://bakaman.net", "th", overrideVersionCode = 1), SingleLang("Banana CĂ­trica", "https://bananacitrica.com", "pt-BR", isNsfw = true, pkgName = "bananamecanica", className = "BananaCitrica", overrideVersionCode = 4), SingleLang("Banana Manga", "https://bananamanga.net", "en", isNsfw = true), diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt index 203f6358d..5444318bd 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt @@ -22,7 +22,6 @@ class MangaThemesiaGenerator : ThemeSourceGenerator { SingleLang("Arena Scans", "https://arenascans.net", "en", overrideVersionCode = 1), SingleLang("Arkham Scan", "https://arkhamscan.com", "pt-BR"), SingleLang("Azure Scans", "https://azuremanga.com", "en", overrideVersionCode = 1), - SingleLang("Babel Wuxia", "https://babelwuxia.com", "en", overrideVersionCode = 1), SingleLang("Banana-Scan", "https://banana-scan.com", "fr", className = "BananaScan", isNsfw = true), SingleLang("Beast Scans", "https://beast-scans.com", "ar"), SingleLang("Boosei", "https://boosei.net", "id", overrideVersionCode = 2),