Henchan chan domains. Add ratelimiter (#1178)

Henchan chan domains. Add ratelimiter
This commit is contained in:
Pavka 2019-06-09 21:24:29 +03:00 committed by Eugene
parent 5cc802663d
commit bc861636fd
2 changed files with 13 additions and 2 deletions

View File

@ -5,11 +5,14 @@ ext {
appName = 'Tachiyomi: Henchan'
pkgNameSuffix = 'ru.henchan'
extClass = '.Henchan'
extVersionCode = 9
extVersionCode = 10
libVersion = '1.2'
}
dependencies {
compileOnly 'com.google.code.gson:gson:2.8.2'
compileOnly 'com.github.salomonbrys.kotson:kotson:2.5.0'
implementation project(':lib-ratelimit')
}
apply from: "$rootDir/common.gradle"

View File

@ -1,5 +1,6 @@
package eu.kanade.tachiyomi.extension.ru.henchan
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
import com.github.salomonbrys.kotson.array
import com.github.salomonbrys.kotson.fromJson
import com.github.salomonbrys.kotson.string
@ -10,6 +11,7 @@ import eu.kanade.tachiyomi.source.model.*
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.Headers
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
import org.jsoup.nodes.Document
@ -22,7 +24,7 @@ class Henchan : ParsedHttpSource() {
override val name = "Henchan"
override val baseUrl = "http://henchan.me"
override val baseUrl = "http://h-chan.me"
private val exhentaiBaseUrl = "http://exhentaidono.me"
@ -30,6 +32,12 @@ class Henchan : ParsedHttpSource() {
override val supportsLatest = true
private val rateLimitInterceptor = RateLimitInterceptor(2)
override val client: OkHttpClient = network.client.newBuilder()
.addNetworkInterceptor(rateLimitInterceptor).build()
override fun popularMangaRequest(page: Int): Request =
GET("$baseUrl/mostfavorites&sort=manga?offset=${20 * (page - 1)}", headers)