pt/Diskus scan: Fix http 403 + fix manga status (#545)

* fix: Fix http 403 - Remove error-triggering headers

* fix: Fix manga status

* chore: Bump version
This commit is contained in:
Claudemirovsky 2024-01-23 22:43:58 -03:00 committed by Draff
parent 56c2069e05
commit bb7d02c94f
2 changed files with 13 additions and 7 deletions

View File

@ -5,8 +5,6 @@ import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SManga
import okhttp3.Headers
import okhttp3.OkHttpClient
import okhttp3.Request
import java.text.SimpleDateFormat
import java.util.Locale
@ -22,19 +20,18 @@ class DiskusScan : MangaThemesia(
// Changed their theme from Madara to MangaThemesia.
override val versionId = 2
override val client: OkHttpClient = super.client.newBuilder()
override val client = super.client.newBuilder()
.rateLimit(2, 1, TimeUnit.SECONDS)
.build()
override fun headersBuilder(): Headers.Builder = super.headersBuilder()
.set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7")
.set("Accept-Language", "pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7,es;q=0.6,gl;q=0.5")
override fun headersBuilder() = super.headersBuilder()
.set("Dnt", "1")
.set("Sec-Fetch-Dest", "document")
.set("Sec-Fetch-Mode", "navigate")
.set("Sec-Fetch-Site", "same-origin")
.set("Sec-Fetch-User", "?1")
// =========================== Manga Details ============================
override fun mangaDetailsRequest(manga: SManga): Request {
val newHeaders = headersBuilder()
.set("Referer", baseUrl + mangaUrlDirectory)
@ -46,8 +43,17 @@ class DiskusScan : MangaThemesia(
override val seriesAuthorSelector = ".infotable tr:contains(Autor) td:last-child"
override val seriesDescriptionSelector = ".entry-content[itemprop=description] > *:not([class^=disku])"
override fun String?.parseStatus() = when (orEmpty().trim().lowercase()) {
"ativa" -> SManga.ONGOING
"finalizada" -> SManga.COMPLETED
"hiato" -> SManga.ON_HIATUS
else -> SManga.UNKNOWN
}
// ============================== Chapters ==============================
override fun chapterListRequest(manga: SManga) = mangaDetailsRequest(manga)
// =============================== Pages ================================
override fun imageUrlRequest(page: Page): Request {
val newHeaders = super.imageUrlRequest(page).headers.newBuilder()
.set("Sec-Fetch-Dest", "image")

View File

@ -33,7 +33,7 @@ class MangaThemesiaGenerator : ThemeSourceGenerator {
SingleLang("Cosmic Scans", "https://cosmic-scans.com", "en", overrideVersionCode = 2),
SingleLang("CosmicScans.id", "https://cosmicscans.id", "id", overrideVersionCode = 3, className = "CosmicScansID"),
SingleLang("Cypher Scans", "https://cypherscans.xyz", "en"),
SingleLang("Diskus Scan", "https://diskusscan.com", "pt-BR", overrideVersionCode = 8),
SingleLang("Diskus Scan", "https://diskusscan.com", "pt-BR", overrideVersionCode = 9),
SingleLang("Dojing.net", "https://dojing.net", "id", isNsfw = true, className = "DojingNet"),
SingleLang("DuniaKomik.id", "https://duniakomik.org", "id", className = "DuniaKomikId", overrideVersionCode = 2),
SingleLang("Elarc Toon", "https://elarctoon.com", "en", className = "ElarcPage", overrideVersionCode = 2),