Invinciblescans: Trial and error the file extension of images. (#10207)

This commit is contained in:
Romain 2025-08-24 11:51:17 +02:00 committed by Draff
parent a4babea523
commit eb480815e8
Signed by: Draff
GPG Key ID: E8A89F3211677653
2 changed files with 19 additions and 5 deletions

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'Invincible ComicsVF' extName = 'Invincible ComicsVF'
extClass = '.InvincibleComics' extClass = '.InvincibleComics'
extVersionCode = 1 extVersionCode = 2
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -22,6 +22,20 @@ class InvincibleComics : HttpSource() {
override val supportsLatest = true override val supportsLatest = true
override val client = network.cloudflareClient.newBuilder().addInterceptor { chain ->
val req = chain.request()
val res = chain.proceed(req)
if (req.url.fragment != "page" || res.code != 404) return@addInterceptor res
res.close()
val newRequest = req.newBuilder()
.url(chain.request().url.toString().replace(".jpg", ".png"))
.build()
chain.proceed(newRequest)
}.build()
// Popular // Popular
override fun popularMangaRequest(page: Int): Request { override fun popularMangaRequest(page: Int): Request {
return GET(baseUrl, headers) return GET(baseUrl, headers)
@ -81,9 +95,9 @@ class InvincibleComics : HttpSource() {
description = document.selectFirst("strong:contains(Résumé)")?.parent()?.ownText() description = document.selectFirst("strong:contains(Résumé)")?.parent()?.ownText()
author = document.selectFirst("strong:contains(Auteur)")?.parent()?.ownText() author = document.selectFirst("strong:contains(Auteur)")?.parent()?.ownText()
genre = document.selectFirst("strong:contains(Genres)")?.parent()?.ownText() genre = document.selectFirst("strong:contains(Genres)")?.parent()?.ownText()
status = when (document.selectFirst("strong:contains(Statut)")?.parent()?.ownText()) { status = when (document.selectFirst("strong:contains(Status)")?.parent()?.ownText()?.trim()) {
"En cours" -> SManga.ONGOING // OK "En cours" -> SManga.ONGOING
"Terminé" -> SManga.COMPLETED // TODO: Check if this is correct "Términé" -> SManga.COMPLETED
else -> SManga.UNKNOWN else -> SManga.UNKNOWN
} }
} }
@ -114,7 +128,7 @@ class InvincibleComics : HttpSource() {
?: error("Failed to extract total pages from script") ?: error("Failed to extract total pages from script")
return (1..totalPages.toInt()).map { pageNumber -> return (1..totalPages.toInt()).map { pageNumber ->
Page(pageNumber, imageUrl = "$imageBaseUrl${"%03d".format(pageNumber)}.png") Page(pageNumber, imageUrl = "$imageBaseUrl${"%03d".format(pageNumber)}.jpg#page")
} }
} }