NineManga - adjust headers (#3060)
This commit is contained in:
parent
324acf49fb
commit
a3fbe74abb
|
@ -5,7 +5,7 @@ ext {
|
||||||
appName = 'Tachiyomi: NineManga'
|
appName = 'Tachiyomi: NineManga'
|
||||||
pkgNameSuffix = "all.ninemanga"
|
pkgNameSuffix = "all.ninemanga"
|
||||||
extClass = '.NineMangaFactory'
|
extClass = '.NineMangaFactory'
|
||||||
extVersionCode = 9
|
extVersionCode = 10
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import java.text.ParseException
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
import okhttp3.Headers
|
||||||
import okhttp3.HttpUrl
|
import okhttp3.HttpUrl
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
|
@ -20,13 +21,9 @@ open class NineManga(override val name: String, override val baseUrl: String, ov
|
||||||
|
|
||||||
override val supportsLatest: Boolean = true
|
override val supportsLatest: Boolean = true
|
||||||
|
|
||||||
private fun newHeaders() = super.headersBuilder()
|
override fun headersBuilder(): Headers.Builder = Headers.Builder()
|
||||||
.add("Accept-Language", "es-ES,es;q=0.9,en;q=0.8,gl;q=0.7")
|
.add("Accept-Language", "es-ES,es;q=0.9,en;q=0.8,gl;q=0.7")
|
||||||
.add("Host", baseUrl.substringAfterLast("/")) // like: es.ninemanga.com
|
.add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) Gecko/20100101 Firefox/75")
|
||||||
.add("Connection", "keep-alive")
|
|
||||||
.add("Upgrade-Insecure-Requests", "1")
|
|
||||||
.add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) Gecko/20100101 Firefox/60")
|
|
||||||
.build()
|
|
||||||
|
|
||||||
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/list/New-Update/", headers) // "$baseUrl/category/updated_$page.html"
|
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/list/New-Update/", headers) // "$baseUrl/category/updated_$page.html"
|
||||||
|
|
||||||
|
@ -107,16 +104,12 @@ open class NineManga(override val name: String, override val baseUrl: String, ov
|
||||||
return 0L
|
return 0L
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun pageListRequest(chapter: SChapter) = GET(baseUrl + chapter.url, newHeaders())
|
|
||||||
|
|
||||||
override fun pageListParse(document: Document): List<Page> = mutableListOf<Page>().apply {
|
override fun pageListParse(document: Document): List<Page> = mutableListOf<Page>().apply {
|
||||||
document.select("select#page").first().select("option").forEach {
|
document.select("select#page").first().select("option").forEach {
|
||||||
add(Page(size, baseUrl + it.attr("value")))
|
add(Page(size, baseUrl + it.attr("value")))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun imageUrlRequest(page: Page) = GET(page.url, newHeaders())
|
|
||||||
|
|
||||||
override fun imageUrlParse(document: Document) = document.select("div.pic_box img.manga_pic").first().attr("src").orEmpty()
|
override fun imageUrlParse(document: Document) = document.select("div.pic_box img.manga_pic").first().attr("src").orEmpty()
|
||||||
|
|
||||||
/*override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
/*override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||||
|
|
|
@ -8,7 +8,6 @@ import java.text.ParseException
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
import okhttp3.Headers
|
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
|
|
||||||
|
@ -449,10 +448,6 @@ class NineMangaIt : NineManga("NineMangaIt", "http://it.ninemanga.com", "it") {
|
||||||
}
|
}
|
||||||
|
|
||||||
class NineMangaFr : NineManga("NineMangaFr", "http://fr.ninemanga.com", "fr") {
|
class NineMangaFr : NineManga("NineMangaFr", "http://fr.ninemanga.com", "fr") {
|
||||||
override fun headersBuilder(): Headers.Builder = Headers.Builder()
|
|
||||||
.add("Accept-Language", "es-ES,es;q=0.9,en;q=0.8,gl;q=0.7")
|
|
||||||
.add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) Gecko/20100101 Firefox/75")
|
|
||||||
|
|
||||||
// ES, FR, RU don't return results for searches with an apostrophe
|
// ES, FR, RU don't return results for searches with an apostrophe
|
||||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||||
return super.searchMangaRequest(page, query.substringBefore("\'"), filters)
|
return super.searchMangaRequest(page, query.substringBefore("\'"), filters)
|
||||||
|
|
Loading…
Reference in New Issue