2022-06-07 23:50:04 +00:00
|
|
|
package eu.kanade.tachiyomi.extension.pt.yanpfansub
|
|
|
|
|
|
|
|
import eu.kanade.tachiyomi.multisrc.madara.Madara
|
|
|
|
import eu.kanade.tachiyomi.network.interceptor.rateLimit
|
|
|
|
import okhttp3.Interceptor
|
|
|
|
import okhttp3.OkHttpClient
|
|
|
|
import okhttp3.Response
|
|
|
|
import java.io.IOException
|
|
|
|
import java.text.SimpleDateFormat
|
|
|
|
import java.util.Locale
|
|
|
|
import java.util.concurrent.TimeUnit
|
|
|
|
|
|
|
|
class YANPFansub : Madara(
|
|
|
|
"YANP Fansub",
|
2023-01-27 20:07:00 +00:00
|
|
|
"https://yanpfansub.com",
|
2022-06-07 23:50:04 +00:00
|
|
|
"pt-BR",
|
2023-02-11 19:21:03 +00:00
|
|
|
SimpleDateFormat("MMMM dd, yyyy", Locale("pt", "BR")),
|
2022-06-07 23:50:04 +00:00
|
|
|
) {
|
|
|
|
|
|
|
|
// Scanlator changed the theme from WpMangaReader to Madara.
|
|
|
|
override val versionId: Int = 2
|
|
|
|
|
2023-07-15 22:52:35 +00:00
|
|
|
override val client: OkHttpClient = super.client.newBuilder()
|
2022-06-07 23:50:04 +00:00
|
|
|
.rateLimit(1, 2, TimeUnit.SECONDS)
|
|
|
|
.addInterceptor(::checkPasswordProtectedIntercept)
|
|
|
|
.build()
|
|
|
|
|
|
|
|
private fun checkPasswordProtectedIntercept(chain: Interceptor.Chain): Response {
|
|
|
|
val response = chain.proceed(chain.request())
|
|
|
|
|
|
|
|
if (response.request.url.queryParameter("password-protected") != null) {
|
|
|
|
response.close()
|
|
|
|
throw IOException("Autentique-se através da WebView e tente novamente.")
|
|
|
|
}
|
|
|
|
|
|
|
|
return response
|
|
|
|
}
|
|
|
|
|
|
|
|
// Page has custom link to scan website.
|
|
|
|
override val popularMangaUrlSelector = "div.post-title a:not([target])"
|
|
|
|
}
|