diff --git a/src/es/legendsnofansub/build.gradle b/src/es/legendsnofansub/build.gradle new file mode 100644 index 000000000..88cecd0fb --- /dev/null +++ b/src/es/legendsnofansub/build.gradle @@ -0,0 +1,10 @@ +ext { + extName = 'Legends No Fansub' + extClass = '.LegendsNoFansub' + themePkg = 'madara' + baseUrl = 'https://legends.nextnovels.com' + overrideVersionCode = 0 + isNsfw = true +} + +apply from: "$rootDir/common.gradle" diff --git a/src/es/legendsnofansub/res/mipmap-hdpi/ic_launcher.png b/src/es/legendsnofansub/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..40dc3fdda Binary files /dev/null and b/src/es/legendsnofansub/res/mipmap-hdpi/ic_launcher.png differ diff --git a/src/es/legendsnofansub/res/mipmap-mdpi/ic_launcher.png b/src/es/legendsnofansub/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..889741389 Binary files /dev/null and b/src/es/legendsnofansub/res/mipmap-mdpi/ic_launcher.png differ diff --git a/src/es/legendsnofansub/res/mipmap-xhdpi/ic_launcher.png b/src/es/legendsnofansub/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..1fb2fcb54 Binary files /dev/null and b/src/es/legendsnofansub/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/src/es/legendsnofansub/res/mipmap-xxhdpi/ic_launcher.png b/src/es/legendsnofansub/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..8fbca5f95 Binary files /dev/null and b/src/es/legendsnofansub/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/src/es/legendsnofansub/res/mipmap-xxxhdpi/ic_launcher.png b/src/es/legendsnofansub/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..4d6f4bd8d Binary files /dev/null and b/src/es/legendsnofansub/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/src/es/legendsnofansub/src/eu/kanade/tachiyomi/extension/es/legendsnofansub/LegendsNoFansub.kt b/src/es/legendsnofansub/src/eu/kanade/tachiyomi/extension/es/legendsnofansub/LegendsNoFansub.kt new file mode 100644 index 000000000..8f33c311f --- /dev/null +++ b/src/es/legendsnofansub/src/eu/kanade/tachiyomi/extension/es/legendsnofansub/LegendsNoFansub.kt @@ -0,0 +1,60 @@ +package eu.kanade.tachiyomi.extension.es.legendsnofansub + +import eu.kanade.tachiyomi.multisrc.madara.Madara +import eu.kanade.tachiyomi.network.POST +import eu.kanade.tachiyomi.network.interceptor.rateLimitHost +import okhttp3.FormBody +import okhttp3.HttpUrl.Companion.toHttpUrl +import okhttp3.Request +import java.text.SimpleDateFormat +import java.util.Locale +import java.util.concurrent.TimeUnit + +class LegendsNoFansub : Madara( + "Legends No Fansub", + "https://legends.nextnovels.com", + "es", + SimpleDateFormat("dd/MM/yyyy", Locale("es")), +) { + override val client = super.client.newBuilder() + .rateLimitHost(baseUrl.toHttpUrl(), 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") + } +}