Add a new source to Madara. (#7290)

This commit is contained in:
Alessandro Jean 2021-05-29 21:25:39 -03:00 committed by GitHub
parent cbcef28f39
commit 0ee2d8d2e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,38 @@
package eu.kanade.tachiyomi.extension.pt.imperiodosotakus
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
class ImperioDosOtakus : Madara(
"Império dos Otakus",
"https://imperiodosotakus.tk",
"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)
}
override val altName: String = "Nome alternativo: "
companion object {
private val NOVEL_REGEX = "novel|livro".toRegex(RegexOption.IGNORE_CASE)
}
}

View File

@ -78,6 +78,7 @@ class MadaraGenerator : ThemeSourceGenerator {
SingleLang("Hunter Fansub", "https://hunterfansub.com", "es"),
SingleLang("Ichirin No Hana Yuri", "https://ichirinnohanayuri.com.br", "pt-BR", overrideVersionCode = 1),
SingleLang("Immortal Updates", "https://immortalupdates.com", "en", overrideVersionCode = 1),
SingleLang("Império dos Otakus", "https://imperiodosotakus.tk", "pt-BR", className = "ImperioDosOtakus"),
SingleLang("IsekaiScan.com", "https://isekaiscan.com", "en", className = "IsekaiScanCom", overrideVersionCode = 2),
SingleLang("IsekaiScanManga (unoriginal)", "https://isekaiscanmanga.com", "en", className = "IsekaiScanManga"),
SingleLang("Its Your Right Manhua", "https://itsyourightmanhua.com/", "en"),