Henchan chan domains. Add ratelimiter (#1178)
Henchan chan domains. Add ratelimiter
This commit is contained in:
parent
5cc802663d
commit
bc861636fd
@ -5,11 +5,14 @@ ext {
|
|||||||
appName = 'Tachiyomi: Henchan'
|
appName = 'Tachiyomi: Henchan'
|
||||||
pkgNameSuffix = 'ru.henchan'
|
pkgNameSuffix = 'ru.henchan'
|
||||||
extClass = '.Henchan'
|
extClass = '.Henchan'
|
||||||
extVersionCode = 9
|
extVersionCode = 10
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly 'com.google.code.gson:gson:2.8.2'
|
compileOnly 'com.google.code.gson:gson:2.8.2'
|
||||||
compileOnly 'com.github.salomonbrys.kotson:kotson:2.5.0'
|
compileOnly 'com.github.salomonbrys.kotson:kotson:2.5.0'
|
||||||
|
|
||||||
|
implementation project(':lib-ratelimit')
|
||||||
|
|
||||||
}
|
}
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package eu.kanade.tachiyomi.extension.ru.henchan
|
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.array
|
||||||
import com.github.salomonbrys.kotson.fromJson
|
import com.github.salomonbrys.kotson.fromJson
|
||||||
import com.github.salomonbrys.kotson.string
|
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.source.online.ParsedHttpSource
|
||||||
import eu.kanade.tachiyomi.util.asJsoup
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
@ -22,7 +24,7 @@ class Henchan : ParsedHttpSource() {
|
|||||||
|
|
||||||
override val name = "Henchan"
|
override val name = "Henchan"
|
||||||
|
|
||||||
override val baseUrl = "http://henchan.me"
|
override val baseUrl = "http://h-chan.me"
|
||||||
|
|
||||||
private val exhentaiBaseUrl = "http://exhentaidono.me"
|
private val exhentaiBaseUrl = "http://exhentaidono.me"
|
||||||
|
|
||||||
@ -30,6 +32,12 @@ class Henchan : ParsedHttpSource() {
|
|||||||
|
|
||||||
override val supportsLatest = true
|
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 =
|
override fun popularMangaRequest(page: Int): Request =
|
||||||
GET("$baseUrl/mostfavorites&sort=manga?offset=${20 * (page - 1)}", headers)
|
GET("$baseUrl/mostfavorites&sort=manga?offset=${20 * (page - 1)}", headers)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user