MangaSee, MangaLife: fix pages again, add rate limiting (#6135)
* MangaSee, MangaLife: fix pages again, add rate limiting * Add referer * More harsh rate limit * Fix again, rate limit even more
This commit is contained in:
parent
1d27e61f65
commit
c589750a11
|
@ -5,8 +5,12 @@ ext {
|
|||
extName = 'MangaLife'
|
||||
pkgNameSuffix = 'en.mangalife'
|
||||
extClass = '.MangaLife'
|
||||
extVersionCode = 13
|
||||
extVersionCode = 14
|
||||
libVersion = '1.2'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':lib-ratelimit')
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.github.salomonbrys.kotson.string
|
|||
import com.google.gson.GsonBuilder
|
||||
import com.google.gson.JsonArray
|
||||
import com.google.gson.JsonElement
|
||||
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.network.asObservableSuccess
|
||||
import eu.kanade.tachiyomi.source.model.Filter
|
||||
|
@ -40,13 +41,17 @@ class MangaLife : HttpSource() {
|
|||
|
||||
override val supportsLatest = true
|
||||
|
||||
private val rateLimitInterceptor = RateLimitInterceptor(1, 2)
|
||||
|
||||
override val client: OkHttpClient = network.cloudflareClient.newBuilder()
|
||||
.addNetworkInterceptor(rateLimitInterceptor)
|
||||
.connectTimeout(1, TimeUnit.MINUTES)
|
||||
.readTimeout(1, TimeUnit.MINUTES)
|
||||
.writeTimeout(1, TimeUnit.MINUTES)
|
||||
.build()
|
||||
|
||||
override fun headersBuilder(): Headers.Builder = Headers.Builder()
|
||||
.add("Referer", baseUrl)
|
||||
.add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/77.0")
|
||||
|
||||
private val gson = GsonBuilder().setLenient().create()
|
||||
|
@ -259,7 +264,7 @@ class MangaLife : HttpSource() {
|
|||
|
||||
val pageTotal = curChapter["Page"].string.toInt()
|
||||
|
||||
val host = "https://" + script.substringAfter("vm.CurrPathName = \"").substringBefore("\"")
|
||||
val host = "https://" + script.substringAfter("vm.justgiveupalready = \"").substringBefore("\"")
|
||||
val titleURI = script.substringAfter("vm.IndexName = \"").substringBefore("\"")
|
||||
val seasonURI = curChapter["Directory"].string
|
||||
.let { if (it.isEmpty()) "" else "$it/" }
|
||||
|
|
|
@ -5,8 +5,12 @@ ext {
|
|||
extName = 'Mangasee'
|
||||
pkgNameSuffix = 'en.mangasee'
|
||||
extClass = '.Mangasee'
|
||||
extVersionCode = 17
|
||||
extVersionCode = 18
|
||||
libVersion = '1.2'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':lib-ratelimit')
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.github.salomonbrys.kotson.string
|
|||
import com.google.gson.GsonBuilder
|
||||
import com.google.gson.JsonArray
|
||||
import com.google.gson.JsonElement
|
||||
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.network.asObservableSuccess
|
||||
import eu.kanade.tachiyomi.source.model.Filter
|
||||
|
@ -43,13 +44,17 @@ class Mangasee : HttpSource() {
|
|||
|
||||
override val supportsLatest = true
|
||||
|
||||
private val rateLimitInterceptor = RateLimitInterceptor(1, 2)
|
||||
|
||||
override val client: OkHttpClient = network.cloudflareClient.newBuilder()
|
||||
.addNetworkInterceptor(rateLimitInterceptor)
|
||||
.connectTimeout(1, TimeUnit.MINUTES)
|
||||
.readTimeout(1, TimeUnit.MINUTES)
|
||||
.writeTimeout(1, TimeUnit.MINUTES)
|
||||
.build()
|
||||
|
||||
override fun headersBuilder(): Headers.Builder = Headers.Builder()
|
||||
.add("Referer", baseUrl)
|
||||
.add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/77.0")
|
||||
|
||||
private val gson = GsonBuilder().setLenient().create()
|
||||
|
@ -263,7 +268,7 @@ class Mangasee : HttpSource() {
|
|||
|
||||
val pageTotal = curChapter["Page"].string.toInt()
|
||||
|
||||
val host = "https://" + script.substringAfter("vm.CurrPathName = \"").substringBefore("\"")
|
||||
val host = "https://" + script.substringAfter("vm.justgiveupalready = \"").substringBefore("\"")
|
||||
val titleURI = script.substringAfter("vm.IndexName = \"").substringBefore("\"")
|
||||
val seasonURI = curChapter["Directory"].string
|
||||
.let { if (it.isEmpty()) "" else "$it/" }
|
||||
|
|
Loading…
Reference in New Issue