NineManga - adjust headers (#3060)

This commit is contained in:
Mike 2020-05-07 15:59:55 -04:00 committed by GitHub
parent 324acf49fb
commit a3fbe74abb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 16 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: NineManga'
pkgNameSuffix = "all.ninemanga"
extClass = '.NineMangaFactory'
extVersionCode = 9
extVersionCode = 10
libVersion = '1.2'
}

View File

@ -11,6 +11,7 @@ import java.text.ParseException
import java.text.SimpleDateFormat
import java.util.Calendar
import java.util.Locale
import okhttp3.Headers
import okhttp3.HttpUrl
import okhttp3.Request
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
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("Host", baseUrl.substringAfterLast("/")) // like: es.ninemanga.com
.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()
.add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) Gecko/20100101 Firefox/75")
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
}
override fun pageListRequest(chapter: SChapter) = GET(baseUrl + chapter.url, newHeaders())
override fun pageListParse(document: Document): List<Page> = mutableListOf<Page>().apply {
document.select("select#page").first().select("option").forEach {
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 searchMangaRequest(page: Int, query: String, filters: FilterList): Request {

View File

@ -8,7 +8,6 @@ import java.text.ParseException
import java.text.SimpleDateFormat
import java.util.Calendar
import java.util.Locale
import okhttp3.Headers
import okhttp3.Request
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") {
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
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
return super.searchMangaRequest(page, query.substringBefore("\'"), filters)