diff --git a/multisrc/overrides/madara/atlantisscan/src/AtlantisScan.kt b/multisrc/overrides/madara/atlantisscan/src/AtlantisScan.kt index e80af1c91..a8d1bc3b9 100644 --- a/multisrc/overrides/madara/atlantisscan/src/AtlantisScan.kt +++ b/multisrc/overrides/madara/atlantisscan/src/AtlantisScan.kt @@ -1,37 +1,62 @@ -package eu.kanade.tachiyomi.extension.all.atlantisscan +package eu.kanade.tachiyomi.extension.es.atlantisscan import eu.kanade.tachiyomi.multisrc.madara.Madara +import eu.kanade.tachiyomi.network.POST import eu.kanade.tachiyomi.network.interceptor.rateLimit -import eu.kanade.tachiyomi.source.SourceFactory +import okhttp3.FormBody import okhttp3.OkHttpClient +import okhttp3.Request import java.text.SimpleDateFormat import java.util.Locale import java.util.concurrent.TimeUnit -class AtlantisScanFactory : SourceFactory { - override fun createSources() = listOf( - AtlantisScanPortuguese(), - AtlantisScanSpanish(), - ) -} - -open class AtlantisScan( - baseUrl: String, - lang: String, - dateFormat: SimpleDateFormat = SimpleDateFormat("dd/MM/yyyy", Locale.US), -) : Madara("Atlantis Scan", baseUrl, lang, dateFormat) - -class AtlantisScanSpanish : AtlantisScan("https://atlantisscan.com", "es") { - - // Name was not capitalized. +class AtlantisScan : Madara( + "Atlantis Scan", + "https://scansatlanticos.com", + "es", + dateFormat = SimpleDateFormat("dd/MM/yyyy", Locale.US), +) { override val id: Long = 2237642340381856331 - override val useNewChapterEndpoint = true -} - -class AtlantisScanPortuguese : AtlantisScan("https://br.atlantisscan.com", "pt-BR") { - override val client: OkHttpClient = super.client.newBuilder() - .rateLimit(1, 2, TimeUnit.SECONDS) + .rateLimit(2, 1, TimeUnit.SECONDS) .build() + + override val useNewChapterEndpoint = true + + override fun popularMangaNextPageSelector() = "body:not(:has(.no-posts))" + + private fun loadMoreRequest(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]", "full") + add("vars[post_type]", "wp-manga") + add("vars[post_status]", "publish") + add("vars[meta_key]", metaKey) + add("vars[order]", "desc") + add("vars[meta_query][relation]", "AND") + add("vars[manga_archives_item_layout]", "big_thumbnail") + }.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 loadMoreRequest(page - 1, "_wp_manga_views") + } + + override fun latestUpdatesRequest(page: Int): Request { + return loadMoreRequest(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 59e87df25..89bbc327e 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 @@ -13,7 +13,6 @@ class MadaraGenerator : ThemeSourceGenerator { override val baseVersionCode: Int = 32 override val sources = listOf( - MultiLang("Atlantis Scan", "https://atlantisscan.com", listOf("es", "pt-BR"), isNsfw = true), MultiLang("MangaForFree.net", "https://mangaforfree.net", listOf("en", "ko", "all"), isNsfw = true, className = "MangaForFreeFactory", pkgName = "mangaforfree", overrideVersionCode = 1), MultiLang("Manhwa18.cc", "https://manhwa18.cc", listOf("en", "ko", "all"), isNsfw = true, className = "Manhwa18CcFactory", pkgName = "manhwa18cc", overrideVersionCode = 4), MultiLang("Reaper Scans", "https://reaperscans.com", listOf("fr", "tr"), className = "ReaperScansFactory", pkgName = "reaperscans", overrideVersionCode = 12), @@ -46,6 +45,7 @@ class MadaraGenerator : ThemeSourceGenerator { SingleLang("Astral-Manga", "https://astral-manga.fr", "fr", className = "AstralManga"), SingleLang("Astrum Scans", "https://astrumscans.xyz", "pt-BR", isNsfw = true), SingleLang("Asura Scans.us (unoriginal)", "https://asurascans.us", "en", isNsfw = false, className = "AsuraScansUs"), + SingleLang("Atlantis Scan", "https://scansatlanticos.com", "es", isNsfw = true), SingleLang("AZManhwa", "https://azmanhwa.net", "en"), SingleLang("Azora", "https://azoranov.com", "ar", overrideVersionCode = 6), SingleLang("Babel Wuxia", "https://babelwuxia.com", "en", overrideVersionCode = 1),