diff --git a/src/en/mangalife/build.gradle b/src/en/mangalife/build.gradle index d3980eedb..9539e01a8 100644 --- a/src/en/mangalife/build.gradle +++ b/src/en/mangalife/build.gradle @@ -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" diff --git a/src/en/mangalife/src/eu/kanade/tachiyomi/extension/en/mangalife/MangaLife.kt b/src/en/mangalife/src/eu/kanade/tachiyomi/extension/en/mangalife/MangaLife.kt index 4c0aea7ae..7a7296d50 100644 --- a/src/en/mangalife/src/eu/kanade/tachiyomi/extension/en/mangalife/MangaLife.kt +++ b/src/en/mangalife/src/eu/kanade/tachiyomi/extension/en/mangalife/MangaLife.kt @@ -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/" } diff --git a/src/en/mangasee/build.gradle b/src/en/mangasee/build.gradle index ba824a01c..e859e7f65 100644 --- a/src/en/mangasee/build.gradle +++ b/src/en/mangasee/build.gradle @@ -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" diff --git a/src/en/mangasee/src/eu/kanade/tachiyomi/extension/en/mangasee/Mangasee.kt b/src/en/mangasee/src/eu/kanade/tachiyomi/extension/en/mangasee/Mangasee.kt index d924c39c4..d2fa5495b 100644 --- a/src/en/mangasee/src/eu/kanade/tachiyomi/extension/en/mangasee/Mangasee.kt +++ b/src/en/mangasee/src/eu/kanade/tachiyomi/extension/en/mangasee/Mangasee.kt @@ -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/" }