Add two new sources to Madara and fix no chapters found in NM. (#16728)

* Add two new sources to Madara.

* Fix no chapters found in NM (closes #16603).
This commit is contained in:
Alessandro Jean 2023-06-12 17:22:02 -03:00 committed by GitHub
parent f1897430d6
commit e7042d5ec9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 73 additions and 9 deletions

View File

@ -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
}

View File

@ -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])"
}

View File

@ -308,6 +308,7 @@ class MadaraGenerator : ThemeSourceGenerator {
SingleLang("MMScans", "https://mm-scans.org", "en", overrideVersionCode = 5), SingleLang("MMScans", "https://mm-scans.org", "en", overrideVersionCode = 5),
SingleLang("Momo no Hana Scan", "https://momonohanascan.com", "pt-BR", className = "MomoNoHanaScan", overrideVersionCode = 1), SingleLang("Momo no Hana Scan", "https://momonohanascan.com", "pt-BR", className = "MomoNoHanaScan", overrideVersionCode = 1),
SingleLang("MonarcaManga", "https://monarcamanga.com", "es"), 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("Moon Witch In Love", "https://moonwitchinlovescan.com", "pt-BR"),
SingleLang("Mortals Groove", "https://mortalsgroove.com", "en", overrideVersionCode = 1), SingleLang("Mortals Groove", "https://mortalsgroove.com", "en", overrideVersionCode = 1),
SingleLang("MR Yaoi Fansub", "https://mrbenne.com", "pt-BR", isNsfw = true, className = "MrYaoiFansub", 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("Tudo Quadrinhos", "https://tudoquadrinhos.com.br", "pt-BR"),
SingleLang("Tumangaonline.site", "https://tumangaonline.site", "es", isNsfw = true, className = "TumangaonlineSite", pkgName = "tumangaonlinesite"), 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("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("Ver Manhwas", "https://vermanhwa.es", "es", isNsfw = true, overrideVersionCode = 1),
SingleLang("VinManga", "https://vinload.com", "en", isNsfw = true), SingleLang("VinManga", "https://vinload.com", "en", isNsfw = true),
SingleLang("Visbellum", "https://visbellum.com", "pt-BR", overrideVersionCode = 2), SingleLang("Visbellum", "https://visbellum.com", "pt-BR", overrideVersionCode = 2),

View File

@ -6,7 +6,7 @@ ext {
extName = 'Nix Mangás' extName = 'Nix Mangás'
pkgNameSuffix = 'pt.nixmangas' pkgNameSuffix = 'pt.nixmangas'
extClass = '.NixMangas' extClass = '.NixMangas'
extVersionCode = 2 extVersionCode = 3
isNsfw = true isNsfw = true
} }

View File

@ -91,13 +91,30 @@ class NixMangas : HttpSource() {
return result.manga.toSManga() 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<SChapter> { override fun chapterListParse(response: Response): List<SChapter> {
val result = response.parseAs<NixMangasDetailsDto>() var result = response.parseAs<NixMangasPaginatedContent<NixMangasChapterDto>>()
val currentTimeStamp = System.currentTimeMillis() 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 } .filter { it.isPublished }
.map(NixMangasChapterDto::toSChapter) .map(NixMangasChapterDto::toSChapter)
.filter { it.date_upload <= currentTimeStamp } .filter { it.date_upload <= currentTimeStamp }
@ -107,11 +124,9 @@ class NixMangas : HttpSource() {
override fun getChapterUrl(chapter: SChapter): String = baseUrl + chapter.url override fun getChapterUrl(chapter: SChapter): String = baseUrl + chapter.url
override fun pageListRequest(chapter: SChapter): Request { override fun pageListRequest(chapter: SChapter): Request {
val apiUrl = (baseUrl + chapter.url).toHttpUrl().newBuilder() val id = chapter.url.substringAfter("/ler/")
.addQueryParameter("_data", "routes/__leitor/ler.\$manga.\$chapter")
.toString()
return GET(apiUrl, apiHeaders) return GET("$API_URL/chapters/$id")
} }
override fun pageListParse(response: Response): List<Page> { override fun pageListParse(response: Response): List<Page> {

View File

@ -60,6 +60,7 @@ data class NixMangasGenreDto(val name: String)
@Serializable @Serializable
data class NixMangasChapterDto( data class NixMangasChapterDto(
val id: String,
@SerialName("is_published") val isPublished: Boolean, @SerialName("is_published") val isPublished: Boolean,
val number: Float, val number: Float,
val pages: List<NixMangasPageDto> = emptyList(), val pages: List<NixMangasPageDto> = emptyList(),
@ -72,7 +73,7 @@ data class NixMangasChapterDto(
chapter_number = number chapter_number = number
date_upload = runCatching { DATE_FORMATTER.parse(publishedAt!!)?.time } date_upload = runCatching { DATE_FORMATTER.parse(publishedAt!!)?.time }
.getOrNull() ?: 0L .getOrNull() ?: 0L
url = "/ler/$slug" url = "/ler/$id"
} }
companion object { companion object {