From bb7d02c94f2756117d7227c413f4cec781471233 Mon Sep 17 00:00:00 2001 From: Claudemirovsky <63046606+Claudemirovsky@users.noreply.github.com> Date: Tue, 23 Jan 2024 22:43:58 -0300 Subject: [PATCH] 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 --- .../mangathemesia/diskusscan/src/DiskusScan.kt | 18 ++++++++++++------ .../mangathemesia/MangaThemesiaGenerator.kt | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/multisrc/overrides/mangathemesia/diskusscan/src/DiskusScan.kt b/multisrc/overrides/mangathemesia/diskusscan/src/DiskusScan.kt index 17bf4b5c0..aa4947a14 100644 --- a/multisrc/overrides/mangathemesia/diskusscan/src/DiskusScan.kt +++ b/multisrc/overrides/mangathemesia/diskusscan/src/DiskusScan.kt @@ -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") diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt index 751ce4ead..79d103189 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangathemesia/MangaThemesiaGenerator.kt @@ -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),