NineManga: Fix thumbnails and page's images (#16697)

Fix thumbnails
This commit is contained in:
Rolando Lecca 2023-06-08 21:12:25 -05:00 committed by GitHub
parent 67dc44c763
commit 7ee2bfc61e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'NineManga'
pkgNameSuffix = "all.ninemanga"
extClass = '.NineMangaFactory'
extVersionCode = 18
extVersionCode = 19
}
apply from: "$rootDir/common.gradle"

View File

@ -9,6 +9,7 @@ import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
import okhttp3.Headers
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import okhttp3.OkHttpClient
import okhttp3.Request
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
@ -25,6 +26,19 @@ open class NineManga(
override val supportsLatest: Boolean = true
override val client: OkHttpClient = network.client.newBuilder()
.addInterceptor { chain ->
val request = chain.request()
val url = request.url.toString()
if (url.contains("""img\d.\.niadd.com""".toRegex())) {
val newRequest = request.newBuilder()
.addHeader("Referer", "$baseUrl/")
.build()
return@addInterceptor chain.proceed(newRequest)
}
chain.proceed(request)
}.build()
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")