Add a new source to Madara (closes #6845). (#6865)

This commit is contained in:
Alessandro Jean 2021-05-06 11:25:27 -03:00 committed by GitHub
parent 7d8f8f28a1
commit 267cc7b988
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 72 additions and 0 deletions

View File

@ -0,0 +1,71 @@
package eu.kanade.tachiyomi.extension.pt.fudidoscanlator
import eu.kanade.tachiyomi.annotations.Nsfw
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
import eu.kanade.tachiyomi.multisrc.madara.Madara
import eu.kanade.tachiyomi.source.model.MangasPage
import okhttp3.OkHttpClient
import okhttp3.Response
import java.text.SimpleDateFormat
import java.util.Locale
import java.util.concurrent.TimeUnit
@Nsfw
class FudidoScanlator : Madara(
"Fudido Scanlator",
"https://fudidoscan.com",
"pt-BR",
SimpleDateFormat("MMMMM dd, yyyy", Locale("pt", "BR"))
) {
override val client: OkHttpClient = super.client.newBuilder()
.addInterceptor(RateLimitInterceptor(1, 1, TimeUnit.SECONDS))
.build()
override fun popularMangaSelector() = "div.page-item-detail.manga"
// The source has novels in text format, so we need to filter them.
override fun searchMangaParse(response: Response): MangasPage {
val mangaPage = super.searchMangaParse(response)
val filteredResult = mangaPage.mangas.filter { it.title.contains(NOVEL_REGEX).not() }
return MangasPage(filteredResult, mangaPage.hasNextPage)
}
// [...document.querySelectorAll('div.genres li a')]
// .map(x => `Genre("${x.innerText.slice(1, -4)}", "${x.href.replace(/.*-genre\/(.*)\//, '$1')}")`)
// .join(',\n')
override fun getGenreList(): List<Genre> = listOf(
Genre("Ação", "acao"),
Genre("Artes Marciais", "artes-marciais"),
Genre("Aventura", "aventura"),
Genre("Comédia", "comedia"),
Genre("Drama", "drama"),
Genre("Ecchi", "ecchi"),
Genre("Escolar", "escolar"),
Genre("Fantasia ", "fantasia"),
Genre("Ficção", "ficcao"),
Genre("Harém", "harem"),
Genre("Horror", "horror"),
Genre("Isekai", "isekai"),
Genre("Josei", "josei"),
Genre("Magia ", "magia"),
Genre("Mistério", "misterio"),
Genre("Protagonista badass", "protagonista-badass"),
Genre("Psicológico", "psicologico"),
Genre("Romance", "romance"),
Genre("Seinen", "seinen"),
Genre("Shoujo", "shoujo"),
Genre("Shounen", "shounen"),
Genre("Slice of Life", "slice-of-life"),
Genre("Sobrenatural", "sobrenatural"),
Genre("Super Poderes", "super-poderes"),
Genre("Suspense", "suspense"),
Genre("Yaoi", "yaoi"),
Genre("Yuri", "yuri")
)
companion object {
private val NOVEL_REGEX = "novel|livro".toRegex(RegexOption.IGNORE_CASE)
}
}

View File

@ -267,6 +267,7 @@ class MadaraGenerator : ThemeSourceGenerator {
SingleLang("MangaYami", "https://www.mangayami.club", "en", overrideVersionCode = 1), SingleLang("MangaYami", "https://www.mangayami.club", "en", overrideVersionCode = 1),
SingleLang("Manga Fenix", "https://manga-fenix.com", "es"), SingleLang("Manga Fenix", "https://manga-fenix.com", "es"),
SingleLang("Manga Mitsu", "https://mangamitsu.com", "en", isNsfw = true, overrideVersionCode = 1), SingleLang("Manga Mitsu", "https://mangamitsu.com", "en", isNsfw = true, overrideVersionCode = 1),
SingleLang("Fudido Scanlator", "https://fudidoscan.com", "pt-BR", isNsfw = true)
) )
companion object { companion object {