Fix Cloudflare loop in GM. (#7105)

This commit is contained in:
Alessandro Jean 2021-05-19 13:06:54 -03:00 committed by GitHub
parent 9936731198
commit 9fb965f4e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 9 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Golden Mangás'
pkgNameSuffix = 'pt.goldenmangas'
extClass = '.GoldenMangas'
extVersionCode = 9
extVersionCode = 10
libVersion = '1.2'
}

View File

@ -35,15 +35,13 @@ class GoldenMangas : ParsedHttpSource() {
.connectTimeout(1, TimeUnit.MINUTES)
.readTimeout(1, TimeUnit.MINUTES)
.writeTimeout(1, TimeUnit.MINUTES)
.addInterceptor(RateLimitInterceptor(1, 1, TimeUnit.SECONDS))
.addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS))
.build()
override fun headersBuilder(): Headers.Builder = Headers.Builder()
.add("Accept", ACCEPT)
.add("Accept-Language", ACCEPT_LANGUAGE)
.add("User-Agent", USER_AGENT)
.add("Origin", baseUrl)
.add("Referer", baseUrl)
.add("Referer", REFERER)
override fun popularMangaRequest(page: Int): Request = GET(baseUrl, headers)
@ -163,9 +161,9 @@ class GoldenMangas : ParsedHttpSource() {
}
}
private fun String.toStatus() = when {
contains("Ativo") -> SManga.ONGOING
contains("Completo") -> SManga.COMPLETED
private fun String.toStatus() = when (this) {
"Ativo" -> SManga.ONGOING
"Completo" -> SManga.COMPLETED
else -> SManga.UNKNOWN
}
@ -178,8 +176,9 @@ class GoldenMangas : ParsedHttpSource() {
"image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
private const val ACCEPT_IMAGE = "image/webp,image/apng,image/*,*/*;q=0.8"
private const val ACCEPT_LANGUAGE = "pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7,es;q=0.6,gl;q=0.5"
private const val REFERER = "https://google.com/"
private const val USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) " +
"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36"
"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"
private val FLAG_REGEX = "\\((Pt[-/]br|Scan)\\)".toRegex(RegexOption.IGNORE_CASE)