Fix two broken sources (#18425)

* Fix a broken source in Madara.

* Fix a broken individual source.

* Fix the linting issue.
This commit is contained in:
Alessandro Jean 2023-10-07 22:49:48 -03:00 committed by GitHub
parent 6a248a073e
commit 655b10f49b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 37 additions and 6 deletions

View File

@ -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)

View File

@ -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<String> = arrayOf(

View File

@ -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"),

View File

@ -5,7 +5,7 @@ ext {
extName = 'Blackout Comics'
pkgNameSuffix = 'pt.blackoutcomics'
extClass = '.BlackoutComics'
extVersionCode = 1
extVersionCode = 2
isNsfw = true
}

View File

@ -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<Page> {
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"))
}