Add a new source to Madara. (#12265)

This commit is contained in:
Alessandro Jean 2022-06-20 15:21:04 -03:00 committed by GitHub
parent c57c31b295
commit c847abe03d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,39 @@
package eu.kanade.tachiyomi.extension.pt.leituranoturna
import eu.kanade.tachiyomi.multisrc.madara.Madara
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import okhttp3.Interceptor
import okhttp3.OkHttpClient
import okhttp3.Response
import okhttp3.internal.closeQuietly
import java.io.IOException
import java.text.SimpleDateFormat
import java.util.Locale
import java.util.concurrent.TimeUnit
class LeituraNoturna : Madara(
"Leitura Noturna",
"https://leituranoturna.com",
"pt-BR",
SimpleDateFormat("dd 'de' MMMMM 'de' yyyy", Locale("pt", "BR"))
) {
override val client: OkHttpClient = super.client.newBuilder()
.rateLimit(1, 2, TimeUnit.SECONDS)
.addInterceptor(::loginCheckIntercept)
.build()
// Page has custom link to scan website.
override val popularMangaUrlSelector = "div.post-title a:not([target])"
private fun loginCheckIntercept(chain: Interceptor.Chain): Response {
val response = chain.proceed(chain.request())
if (response.request.url.toString().contains("wp-login")) {
response.closeQuietly()
throw IOException("Faça login pela WebView para utilizar a extensão.")
}
return response
}
}

View File

@ -166,6 +166,7 @@ class MadaraGenerator : ThemeSourceGenerator {
SingleLang("LHTranslation", "https://lhtranslation.net", "en", overrideVersionCode = 1),
SingleLang("Lara Manga", "https://laramanga.com", "en"),
SingleLang("Latest Manga", "https://latestmanga.net", "en", overrideVersionCode = 1),
SingleLang("Leitura Noturna", "https://leituranoturna.com", "pt-BR", isNsfw = true),
SingleLang("Levelerscans", "https://levelerscans.xyz", "en", overrideVersionCode = 1),
SingleLang("Leviatan Scans X", "https://xxx.leviatanscans.com", "en", isNsfw = true),
SingleLang("Lily Manga", "https://lilymanga.com", "en"),