diff --git a/multisrc/overrides/madara/moonloversscan/src/MoonLoversScan.kt b/multisrc/overrides/madara/moonloversscan/src/MoonLoversScan.kt new file mode 100644 index 000000000..f18ea3d70 --- /dev/null +++ b/multisrc/overrides/madara/moonloversscan/src/MoonLoversScan.kt @@ -0,0 +1,22 @@ +package eu.kanade.tachiyomi.extension.pt.moonloversscan + +import eu.kanade.tachiyomi.multisrc.madara.Madara +import eu.kanade.tachiyomi.network.interceptor.rateLimit +import okhttp3.OkHttpClient +import java.text.SimpleDateFormat +import java.util.Locale +import java.util.concurrent.TimeUnit + +class MoonLoversScan : Madara( + "MoonLovers Scan", + "https://moonloversscan.com.br", + "pt-BR", + SimpleDateFormat("MMMMM dd, yyyy", Locale("pt", "BR")), +) { + + override val client: OkHttpClient = super.client.newBuilder() + .rateLimit(1, 2, TimeUnit.SECONDS) + .build() + + override val useNewChapterEndpoint = true +} diff --git a/multisrc/overrides/madara/valkyriescan/src/ValkyrieScan.kt b/multisrc/overrides/madara/valkyriescan/src/ValkyrieScan.kt new file mode 100644 index 000000000..ca30cc10d --- /dev/null +++ b/multisrc/overrides/madara/valkyriescan/src/ValkyrieScan.kt @@ -0,0 +1,24 @@ +package eu.kanade.tachiyomi.extension.pt.valkyriescan + +import eu.kanade.tachiyomi.multisrc.madara.Madara +import eu.kanade.tachiyomi.network.interceptor.rateLimit +import okhttp3.OkHttpClient +import java.text.SimpleDateFormat +import java.util.Locale +import java.util.concurrent.TimeUnit + +class ValkyrieScan : Madara( + "Valkyrie Scan", + "https://valkyriescan.com", + "pt-BR", + SimpleDateFormat("dd/MM/yyyy", Locale("pt", "BR")), +) { + + override val client: OkHttpClient = super.client.newBuilder() + .rateLimit(1, 2, TimeUnit.SECONDS) + .build() + + override val useNewChapterEndpoint = true + + override val popularMangaUrlSelector = "div.post-title a:not([target])" +} 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 887118ce4..6b2cc5fc0 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 @@ -308,6 +308,7 @@ class MadaraGenerator : ThemeSourceGenerator { SingleLang("MMScans", "https://mm-scans.org", "en", overrideVersionCode = 5), SingleLang("Momo no Hana Scan", "https://momonohanascan.com", "pt-BR", className = "MomoNoHanaScan", overrideVersionCode = 1), SingleLang("MonarcaManga", "https://monarcamanga.com", "es"), + SingleLang("MoonLovers Scan", "https://moonloversscan.com.br", "pt-BR", isNsfw = true), SingleLang("Moon Witch In Love", "https://moonwitchinlovescan.com", "pt-BR"), SingleLang("Mortals Groove", "https://mortalsgroove.com", "en", overrideVersionCode = 1), SingleLang("MR Yaoi Fansub", "https://mrbenne.com", "pt-BR", isNsfw = true, className = "MrYaoiFansub", overrideVersionCode = 1), @@ -417,6 +418,7 @@ class MadaraGenerator : ThemeSourceGenerator { SingleLang("Tudo Quadrinhos", "https://tudoquadrinhos.com.br", "pt-BR"), SingleLang("Tumangaonline.site", "https://tumangaonline.site", "es", isNsfw = true, className = "TumangaonlineSite", pkgName = "tumangaonlinesite"), SingleLang("Türkçe Manga", "https://turkcemanga.com", "tr", className = "TurkceManga", overrideVersionCode = 2), + SingleLang("Valkyrie Scan", "https://valkyriescan.com", "pt-BR", isNsfw = true), SingleLang("Ver Manhwas", "https://vermanhwa.es", "es", isNsfw = true, overrideVersionCode = 1), SingleLang("VinManga", "https://vinload.com", "en", isNsfw = true), SingleLang("Visbellum", "https://visbellum.com", "pt-BR", overrideVersionCode = 2), diff --git a/src/pt/nixmangas/build.gradle b/src/pt/nixmangas/build.gradle index 209f940fa..a161d0713 100644 --- a/src/pt/nixmangas/build.gradle +++ b/src/pt/nixmangas/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'Nix Mangás' pkgNameSuffix = 'pt.nixmangas' extClass = '.NixMangas' - extVersionCode = 2 + extVersionCode = 3 isNsfw = true } diff --git a/src/pt/nixmangas/src/eu/kanade/tachiyomi/extension/pt/nixmangas/NixMangas.kt b/src/pt/nixmangas/src/eu/kanade/tachiyomi/extension/pt/nixmangas/NixMangas.kt index e3e473548..47711914f 100644 --- a/src/pt/nixmangas/src/eu/kanade/tachiyomi/extension/pt/nixmangas/NixMangas.kt +++ b/src/pt/nixmangas/src/eu/kanade/tachiyomi/extension/pt/nixmangas/NixMangas.kt @@ -91,13 +91,30 @@ class NixMangas : HttpSource() { return result.manga.toSManga() } - override fun chapterListRequest(manga: SManga): Request = mangaDetailsRequest(manga) + override fun chapterListRequest(manga: SManga): Request { + val slug = manga.url.substringAfter("/obras/") + + return chapterListPaginatedRequest(slug) + } + + private fun chapterListPaginatedRequest(slug: String, page: Int = 1): Request { + return GET("$API_URL/mangas/$slug/chapters?page=$page", apiHeaders) + } override fun chapterListParse(response: Response): List { - val result = response.parseAs() + var result = response.parseAs>() val currentTimeStamp = System.currentTimeMillis() + val chapters = result.data.toMutableList() + val slug = response.request.url.pathSegments[2] - return result.manga.chapters + while (result.currentPage < result.lastPage) { + val nextRequest = chapterListPaginatedRequest(slug, result.currentPage + 1) + result = client.newCall(nextRequest).execute().parseAs() + + chapters += result.data + } + + return chapters .filter { it.isPublished } .map(NixMangasChapterDto::toSChapter) .filter { it.date_upload <= currentTimeStamp } @@ -107,11 +124,9 @@ class NixMangas : HttpSource() { override fun getChapterUrl(chapter: SChapter): String = baseUrl + chapter.url override fun pageListRequest(chapter: SChapter): Request { - val apiUrl = (baseUrl + chapter.url).toHttpUrl().newBuilder() - .addQueryParameter("_data", "routes/__leitor/ler.\$manga.\$chapter") - .toString() + val id = chapter.url.substringAfter("/ler/") - return GET(apiUrl, apiHeaders) + return GET("$API_URL/chapters/$id") } override fun pageListParse(response: Response): List { diff --git a/src/pt/nixmangas/src/eu/kanade/tachiyomi/extension/pt/nixmangas/NixMangasDto.kt b/src/pt/nixmangas/src/eu/kanade/tachiyomi/extension/pt/nixmangas/NixMangasDto.kt index 38a54fb82..a33af7489 100644 --- a/src/pt/nixmangas/src/eu/kanade/tachiyomi/extension/pt/nixmangas/NixMangasDto.kt +++ b/src/pt/nixmangas/src/eu/kanade/tachiyomi/extension/pt/nixmangas/NixMangasDto.kt @@ -60,6 +60,7 @@ data class NixMangasGenreDto(val name: String) @Serializable data class NixMangasChapterDto( + val id: String, @SerialName("is_published") val isPublished: Boolean, val number: Float, val pages: List = emptyList(), @@ -72,7 +73,7 @@ data class NixMangasChapterDto( chapter_number = number date_upload = runCatching { DATE_FORMATTER.parse(publishedAt!!)?.time } .getOrNull() ?: 0L - url = "/ler/$slug" + url = "/ler/$id" } companion object {