From 655b10f49b6ad18cdb3e246c5f791f74b621aea0 Mon Sep 17 00:00:00 2001 From: Alessandro Jean <14254807+alessandrojean@users.noreply.github.com> Date: Sat, 7 Oct 2023 22:49:48 -0300 Subject: [PATCH] Fix two broken sources (#18425) * Fix a broken source in Madara. * Fix a broken individual source. * Fix the linting issue. --- .../overrides/madara/izakaya/src/Izakaya.kt | 15 ++++++++++++- .../tachiyomi/multisrc/madara/Madara.kt | 2 +- .../multisrc/madara/MadaraGenerator.kt | 2 +- src/pt/blackoutcomics/build.gradle | 2 +- .../pt/blackoutcomics/BlackoutComics.kt | 22 +++++++++++++++++-- 5 files changed, 37 insertions(+), 6 deletions(-) diff --git a/multisrc/overrides/madara/izakaya/src/Izakaya.kt b/multisrc/overrides/madara/izakaya/src/Izakaya.kt index 752e1050b..dcde6d952 100644 --- a/multisrc/overrides/madara/izakaya/src/Izakaya.kt +++ b/multisrc/overrides/madara/izakaya/src/Izakaya.kt @@ -4,6 +4,7 @@ import eu.kanade.tachiyomi.multisrc.madara.Madara 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.SChapter import okhttp3.OkHttpClient import okhttp3.Request import java.text.SimpleDateFormat @@ -18,11 +19,23 @@ class Izakaya : Madara( ) { override val client: OkHttpClient = super.client.newBuilder() - .rateLimit(1, 2, TimeUnit.SECONDS) + .rateLimit(1, 3, TimeUnit.SECONDS) .build() override val useNewChapterEndpoint = true + override val chapterUrlSuffix = "" + + override fun pageListRequest(chapter: SChapter): Request { + val fixedUrl = chapter.url.substringBeforeLast("?style=") + + if (fixedUrl.startsWith("http")) { + return GET(fixedUrl, headers) + } + + return GET(baseUrl + fixedUrl, headers) + } + override fun imageRequest(page: Page): Request { val newHeaders = headersBuilder() .set("Referer", page.url) diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/Madara.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/Madara.kt index 87a14ffd8..cae0545f8 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/Madara.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/Madara.kt @@ -473,7 +473,7 @@ abstract class Madara( "OnGoing", "Продолжается", "Updating", "Em Lançamento", "Em lançamento", "Em andamento", "Em Andamento", "En cours", "En Cours", "En cours de publication", "Ativo", "Lançando", "Đang Tiến Hành", "Devam Ediyor", "Devam ediyor", "In Corso", "In Arrivo", "مستمرة", "مستمر", "En Curso", "En curso", "Emision", - "Curso", "En marcha", "Publicandose", "En emision", "连载中", + "Curso", "En marcha", "Publicandose", "En emision", "连载中", "Em Lançamento", ) protected val hiatusStatusList: Array = arrayOf( diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt index fb46f11cc..8325fe2f9 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt @@ -167,7 +167,7 @@ class MadaraGenerator : ThemeSourceGenerator { SingleLang("IsekaiScan.top (unoriginal)", "https://isekaiscan.top", "en", pkgName = "isekaiscantop", className = "IsekaiScanTop", overrideVersionCode = 1), SingleLang("IsekaiScanManga (unoriginal)", "https://isekaiscanmanga.com", "en", className = "IsekaiScanManga", overrideVersionCode = 1), SingleLang("Its Your Right Manhua", "https://itsyourightmanhua.com", "en", className = "ItsYourRightManhua", overrideVersionCode = 2), - SingleLang("Izakaya", "https://leitorizakaya.net", "pt-BR", isNsfw = true, overrideVersionCode = 1), + SingleLang("Izakaya", "https://leitorizakaya.net", "pt-BR", isNsfw = true, overrideVersionCode = 2), SingleLang("Jiangzaitoon", "https://jiangzaitoon.co", "tr", isNsfw = true, overrideVersionCode = 2), SingleLang("Jimanga", "https://jimanga.com", "en", isNsfw = false), SingleLang("Kakusei Project", "https://kakuseiproject.com.br", "pt-BR"), diff --git a/src/pt/blackoutcomics/build.gradle b/src/pt/blackoutcomics/build.gradle index 82aa29792..994fff687 100644 --- a/src/pt/blackoutcomics/build.gradle +++ b/src/pt/blackoutcomics/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'Blackout Comics' pkgNameSuffix = 'pt.blackoutcomics' extClass = '.BlackoutComics' - extVersionCode = 1 + extVersionCode = 2 isNsfw = true } diff --git a/src/pt/blackoutcomics/src/eu/kanade/tachiyomi/extension/pt/blackoutcomics/BlackoutComics.kt b/src/pt/blackoutcomics/src/eu/kanade/tachiyomi/extension/pt/blackoutcomics/BlackoutComics.kt index 8d528c94f..bba89513c 100644 --- a/src/pt/blackoutcomics/src/eu/kanade/tachiyomi/extension/pt/blackoutcomics/BlackoutComics.kt +++ b/src/pt/blackoutcomics/src/eu/kanade/tachiyomi/extension/pt/blackoutcomics/BlackoutComics.kt @@ -28,10 +28,12 @@ class BlackoutComics : ParsedHttpSource() { override val supportsLatest = true override val client: OkHttpClient = network.cloudflareClient.newBuilder() - .rateLimit(1, 2, TimeUnit.SECONDS) + .rateLimit(1, 3, TimeUnit.SECONDS) .build() override fun headersBuilder(): Headers.Builder = Headers.Builder() + .add("Accept", ACCEPT) + .add("Accept-Language", ACCEPT_LANGUAGE) .add("Referer", "$baseUrl/") override fun popularMangaRequest(page: Int): Request = GET(baseUrl, headers) @@ -90,7 +92,7 @@ class BlackoutComics : ParsedHttpSource() { thumbnail_url = infoElement.selectFirst("img")!!.absUrl("src") } - override fun chapterListSelector() = "section.relese h5" + override fun chapterListSelector() = "section.relese h5:not(:has(img.vip))" override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply { name = element.selectFirst("a")!!.ownText() @@ -98,6 +100,18 @@ class BlackoutComics : ParsedHttpSource() { url = element.selectFirst("a")!!.attr("href") } + override fun pageListRequest(chapter: SChapter): Request { + val newHeaders = headersBuilder() + .set("Referer", baseUrl + chapter.url.substringBeforeLast("/ler")) + .add("Sec-Fetch-Dest", "document") + .add("Sec-Fetch-Mode", "navigate") + .add("Sec-Fetch-Site", "same-origin") + .add("Sec-Fetch-User", "?1") + .build() + + return GET(baseUrl + chapter.url, newHeaders) + } + override fun pageListParse(document: Document): List { return document.select("div.chapter-image canvas") .mapIndexed { index, element -> @@ -110,6 +124,7 @@ class BlackoutComics : ParsedHttpSource() { override fun imageRequest(page: Page): Request { val newHeaders = headersBuilder() .set("Referer", page.url) + .set("Accept", "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8") .build() return GET(page.imageUrl!!, newHeaders) @@ -129,6 +144,9 @@ class BlackoutComics : ParsedHttpSource() { } companion object { + private const val ACCEPT = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8" + private const val ACCEPT_LANGUAGE = "pt-BR,pt;q=0.8,en-US;q=0.5,en;q=0.3" + private val DATE_FORMATTER by lazy { SimpleDateFormat("dd/MM/yyyy", Locale("pt", "BR")) }