From 62685514b9f1628a6153ad7590004756db4ec0dc Mon Sep 17 00:00:00 2001 From: Taumer Date: Thu, 18 Jan 2018 21:07:04 +0300 Subject: [PATCH] Add referer to readmanga/mintmanga requests header (#160) --- src/ru/mintmanga/build.gradle | 2 +- .../eu/kanade/tachiyomi/extension/ru/mintmanga/Mintmanga.kt | 6 ++++++ src/ru/readmanga/build.gradle | 2 +- .../eu/kanade/tachiyomi/extension/ru/readmanga/Readmanga.kt | 6 ++++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/ru/mintmanga/build.gradle b/src/ru/mintmanga/build.gradle index 576a40ef9..1aea6124b 100644 --- a/src/ru/mintmanga/build.gradle +++ b/src/ru/mintmanga/build.gradle @@ -5,7 +5,7 @@ ext { appName = 'Tachiyomi: Mintmanga' pkgNameSuffix = "ru.mintmanga" extClass = '.Mintmanga' - extVersionCode = 3 + extVersionCode = 4 extVersionSuffix = 0 libVersion = '1.2' } diff --git a/src/ru/mintmanga/src/eu/kanade/tachiyomi/extension/ru/mintmanga/Mintmanga.kt b/src/ru/mintmanga/src/eu/kanade/tachiyomi/extension/ru/mintmanga/Mintmanga.kt index b5146b96a..1ed2c5ee6 100644 --- a/src/ru/mintmanga/src/eu/kanade/tachiyomi/extension/ru/mintmanga/Mintmanga.kt +++ b/src/ru/mintmanga/src/eu/kanade/tachiyomi/extension/ru/mintmanga/Mintmanga.kt @@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.extension.ru.mintmanga import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.source.model.* import eu.kanade.tachiyomi.source.online.ParsedHttpSource +import okhttp3.Headers import okhttp3.Request import okhttp3.Response import org.jsoup.nodes.Document @@ -23,6 +24,11 @@ class Mintmanga : ParsedHttpSource() { override val supportsLatest = true + override fun headersBuilder() = Headers.Builder().apply { + add("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64)") + add("Referer", baseUrl) + } + override fun popularMangaRequest(page: Int): Request = GET("$baseUrl/list?sortType=rate&offset=${70 * (page - 1)}&max=70", headers) diff --git a/src/ru/readmanga/build.gradle b/src/ru/readmanga/build.gradle index 1ccec7cc4..205827f40 100644 --- a/src/ru/readmanga/build.gradle +++ b/src/ru/readmanga/build.gradle @@ -5,7 +5,7 @@ ext { appName = 'Tachiyomi: Readmanga' pkgNameSuffix = "ru.readmanga" extClass = '.Readmanga' - extVersionCode = 3 + extVersionCode = 4 extVersionSuffix = 0 libVersion = '1.2' } diff --git a/src/ru/readmanga/src/eu/kanade/tachiyomi/extension/ru/readmanga/Readmanga.kt b/src/ru/readmanga/src/eu/kanade/tachiyomi/extension/ru/readmanga/Readmanga.kt index a1da1ea2d..68533f3a9 100644 --- a/src/ru/readmanga/src/eu/kanade/tachiyomi/extension/ru/readmanga/Readmanga.kt +++ b/src/ru/readmanga/src/eu/kanade/tachiyomi/extension/ru/readmanga/Readmanga.kt @@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.extension.ru.readmanga import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.source.model.* import eu.kanade.tachiyomi.source.online.ParsedHttpSource +import okhttp3.Headers import okhttp3.Request import okhttp3.Response import org.jsoup.nodes.Document @@ -27,6 +28,11 @@ class Readmanga : ParsedHttpSource() { override fun latestUpdatesSelector() = "div.desc" + override fun headersBuilder() = Headers.Builder().apply { + add("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64)") + add("Referer", baseUrl) + } + override fun popularMangaRequest(page: Int): Request = GET("$baseUrl/list?sortType=rate&offset=${70 * (page - 1)}&max=70", headers)