Genkan/MangaHasu: pass headers with GET requests (#1612)

This commit is contained in:
arkon 2019-10-04 18:38:45 -04:00 committed by GitHub
parent 98d477b28c
commit 9d155574fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 11 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: Genkan (multiple sources)' appName = 'Tachiyomi: Genkan (multiple sources)'
pkgNameSuffix = 'all.genkan' pkgNameSuffix = 'all.genkan'
extClass = '.GenkanFactory' extClass = '.GenkanFactory'
extVersionCode = 6 extVersionCode = 7
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -26,7 +26,7 @@ abstract class Genkan(
override fun popularMangaSelector() = "div.list-item" override fun popularMangaSelector() = "div.list-item"
override fun popularMangaRequest(page: Int): Request { override fun popularMangaRequest(page: Int): Request {
return GET("$baseUrl/comics?page=$page") return GET("$baseUrl/comics?page=$page", headers)
} }
override fun latestUpdatesSelector() = popularMangaSelector() override fun latestUpdatesSelector() = popularMangaSelector()
@ -36,7 +36,7 @@ abstract class Genkan(
override fun latestUpdatesRequest(page: Int): Request { override fun latestUpdatesRequest(page: Int): Request {
if (page == 1) latestUpdatesTitles.clear() if (page == 1) latestUpdatesTitles.clear()
return GET("$baseUrl/latest?page=$page") return GET("$baseUrl/latest?page=$page", headers)
} }
// To prevent dupes, only add manga to MangasPage if its title is not one we've added already // To prevent dupes, only add manga to MangasPage if its title is not one we've added already
@ -75,7 +75,7 @@ abstract class Genkan(
// Search // Search
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
return GET("$baseUrl/comics?query=$query") return GET("$baseUrl/comics?query=$query", headers)
} }
override fun searchMangaSelector() = popularMangaSelector() override fun searchMangaSelector() = popularMangaSelector()

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: Mangahasu' appName = 'Tachiyomi: Mangahasu'
pkgNameSuffix = 'en.mangahasu' pkgNameSuffix = 'en.mangahasu'
extClass = '.Mangahasu' extClass = '.Mangahasu'
extVersionCode = 4 extVersionCode = 5
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -27,10 +27,10 @@ class Mangahasu: ParsedHttpSource() {
override val client: OkHttpClient = network.cloudflareClient override val client: OkHttpClient = network.cloudflareClient
override fun popularMangaRequest(page: Int): Request = override fun popularMangaRequest(page: Int): Request =
GET("$baseUrl/directory.html?page=$page") GET("$baseUrl/directory.html?page=$page", headers)
override fun latestUpdatesRequest(page: Int): Request = override fun latestUpdatesRequest(page: Int): Request =
GET("$baseUrl/latest-releases.html?page=$page") GET("$baseUrl/latest-releases.html?page=$page", headers)
override fun popularMangaSelector() = "div.div_item" override fun popularMangaSelector() = "div.div_item"
@ -54,7 +54,7 @@ class Mangahasu: ParsedHttpSource() {
override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector() override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector()
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
return GET("$baseUrl/advanced-search.html?keyword=$query&author=&artist=&status=&typeid=&page=$page") return GET("$baseUrl/advanced-search.html?keyword=$query&author=&artist=&status=&typeid=&page=$page", headers)
} }
override fun searchMangaSelector() = override fun searchMangaSelector() =
@ -124,11 +124,10 @@ class Mangahasu: ParsedHttpSource() {
override fun imageUrlParse(document: Document) = "" override fun imageUrlParse(document: Document) = ""
override fun imageRequest(page: Page): Request { override fun imageRequest(page: Page): Request {
val imgHeader = Headers.Builder().apply { val imgHeader = headers.newBuilder().apply {
add("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64)")
add("Referer", baseUrl) add("Referer", baseUrl)
}.build() }.build()
return GET(page.imageUrl!!, imgHeader) return GET(page.imageUrl!!, imgHeader)
} }
} }