Add some missing headers in MangaThemesia (#18515)

Add some missing headers in MangaThemesia.
This commit is contained in:
Alessandro Jean 2023-10-12 17:19:07 -03:00 committed by GitHub
parent 8594c4ec93
commit 713bfccec5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.extension.pt.diskusscan
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.network.interceptor.rateLimit
import okhttp3.Headers
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Locale import java.util.Locale
@ -20,4 +21,8 @@ class DiskusScan : MangaThemesia(
override val client: OkHttpClient = super.client.newBuilder() override val client: OkHttpClient = super.client.newBuilder()
.rateLimit(1, 2, TimeUnit.SECONDS) .rateLimit(1, 2, TimeUnit.SECONDS)
.build() .build()
override fun headersBuilder(): Headers.Builder = super.headersBuilder()
.set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8")
.set("Accept-Language", "pt-BR,pt;q=0.8,en-US;q=0.5,en;q=0.3")
} }

View File

@ -22,6 +22,7 @@ import kotlinx.serialization.json.Json
import kotlinx.serialization.json.jsonArray import kotlinx.serialization.json.jsonArray
import kotlinx.serialization.json.jsonPrimitive import kotlinx.serialization.json.jsonPrimitive
import okhttp3.FormBody import okhttp3.FormBody
import okhttp3.Headers
import okhttp3.HttpUrl import okhttp3.HttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
@ -68,6 +69,9 @@ abstract class MangaThemesia(
.build() .build()
} }
override fun headersBuilder(): Headers.Builder = Headers.Builder()
.set("Referer", "$baseUrl/")
open val projectPageString = "/project" open val projectPageString = "/project"
// Popular (Search with popular order and nothing else) // Popular (Search with popular order and nothing else)
@ -141,7 +145,7 @@ abstract class MangaThemesia(
} }
} }
url.addPathSegment("") url.addPathSegment("")
return GET(url.toString()) return GET(url.build(), headers)
} }
override fun searchMangaParse(response: Response): MangasPage { override fun searchMangaParse(response: Response): MangasPage {
@ -215,6 +219,7 @@ abstract class MangaThemesia(
listOf("ongoing", "publishing").any { this.contains(it, ignoreCase = true) } -> SManga.ONGOING listOf("ongoing", "publishing").any { this.contains(it, ignoreCase = true) } -> SManga.ONGOING
this.contains("hiatus", ignoreCase = true) -> SManga.ON_HIATUS this.contains("hiatus", ignoreCase = true) -> SManga.ON_HIATUS
this.contains("completed", ignoreCase = true) -> SManga.COMPLETED this.contains("completed", ignoreCase = true) -> SManga.COMPLETED
listOf("dropped", "cancelled").any { this.contains(it, ignoreCase = true) } -> SManga.CANCELLED
else -> SManga.UNKNOWN else -> SManga.UNKNOWN
} }
@ -289,6 +294,7 @@ abstract class MangaThemesia(
override fun imageRequest(page: Page): Request { override fun imageRequest(page: Page): Request {
val newHeaders = headersBuilder() val newHeaders = headersBuilder()
.set("Accept", "image/avif,image/webp,image/png,image/jpeg,*/*")
.set("Referer", page.url) .set("Referer", page.url)
.build() .build()

View File

@ -11,7 +11,7 @@ class MangaThemesiaGenerator : ThemeSourceGenerator {
override val themeClass = "MangaThemesia" override val themeClass = "MangaThemesia"
override val baseVersionCode: Int = 26 override val baseVersionCode: Int = 27
override val sources = listOf( override val sources = listOf(
MultiLang("Asura Scans", "https://asuratoon.com", listOf("en", "tr"), className = "AsuraScansFactory", pkgName = "asurascans", overrideVersionCode = 30), MultiLang("Asura Scans", "https://asuratoon.com", listOf("en", "tr"), className = "AsuraScansFactory", pkgName = "asurascans", overrideVersionCode = 30),