Keyoapp: Fix CDN URL (#5711)

* Fix CDN URL

* Fix theme cdn url

* Add Arabic and French translations

* Fix fallback method

* Update WickedScans domain

* Update messages
This commit is contained in:
Chopper 2024-10-28 07:00:21 -03:00 committed by GitHub
parent 12cf12a344
commit 8df6347cea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 32 additions and 30 deletions

View File

@ -0,0 +1,4 @@
pref_show_paid_chapter_title=عرض الفصول المدفوعة
pref_show_paid_chapter_summary_on=سيتم عرض الفصول المدفوعة
pref_show_paid_chapter_summary_off=سيتم عرض الفصول المجانية فقط.
chapter_page_url_not_found=رابط الصفحة غير موجود

View File

@ -1,3 +1,4 @@
pref_show_paid_chapter_title=Display paid chapters pref_show_paid_chapter_title=Display paid chapters
pref_show_paid_chapter_summary_on=Paid chapters will appear. pref_show_paid_chapter_summary_on=Paid chapters will appear.
pref_show_paid_chapter_summary_off=Only free chapters will be displayed. pref_show_paid_chapter_summary_off=Only free chapters will be displayed.
chapter_page_url_not_found=Page URL not found

View File

@ -0,0 +1,4 @@
pref_show_paid_chapter_title=Afficher les chapitres payants
pref_show_paid_chapter_summary_on=Les chapitres payants apparaitront.
pref_show_paid_chapter_summary_off=Seuls les chapitres gratuits apparaitront.
chapter_page_url_not_found=Page URL non trouvée

View File

@ -2,7 +2,7 @@ plugins {
id("lib-multisrc") id("lib-multisrc")
} }
baseVersionCode = 8 baseVersionCode = 9
dependencies { dependencies {
api(project(":lib:i18n")) api(project(":lib:i18n"))

View File

@ -18,7 +18,6 @@ import eu.kanade.tachiyomi.util.asJsoup
import kotlinx.serialization.decodeFromString import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import okhttp3.Request import okhttp3.Request
import okhttp3.Response import okhttp3.Response
import org.jsoup.nodes.Document import org.jsoup.nodes.Document
@ -55,7 +54,7 @@ abstract class Keyoapp(
protected val intl = Intl( protected val intl = Intl(
language = lang, language = lang,
baseLanguage = "en", baseLanguage = "en",
availableLanguages = setOf("en"), availableLanguages = setOf("ar", "en", "fr"),
classLoader = this::class.java.classLoader!!, classLoader = this::class.java.classLoader!!,
) )
@ -259,9 +258,11 @@ abstract class Keyoapp(
// Image list // Image list
override fun pageListParse(document: Document): List<Page> { override fun pageListParse(document: Document): List<Page> {
val cdnUrl = getCdnUrl(document)
document.select("#pages > img") document.select("#pages > img")
.map { it.attr("uid") } .map { it.attr("uid") }
.filter { it.isNotEmpty() } .filter { it.isNotEmpty() }
.also { cdnUrl ?: throw Exception(intl["chapter_page_url_not_found"]) }
.mapIndexed { index, img -> .mapIndexed { index, img ->
Page(index, document.location(), "$cdnUrl/$img") Page(index, document.location(), "$cdnUrl/$img")
} }
@ -277,7 +278,16 @@ abstract class Keyoapp(
} }
} }
protected open val cdnUrl = "https://2xffbs-cn8.is1.buzz/uploads" protected open fun getCdnUrl(document: Document): String? {
return document.select("script")
.firstOrNull { CDN_HOST_REGEX.containsMatchIn(it.html()) }
?.let {
val cdnHost = CDN_HOST_REGEX.find(it.html())
?.groups?.get("host")?.value
?.replace(CDN_CLEAN_REGEX, "")
"https://$cdnHost/uploads"
}
}
private val oldImgCdnRegex = Regex("""^(https?:)?//cdn\d*\.keyoapp\.com""") private val oldImgCdnRegex = Regex("""^(https?:)?//cdn\d*\.keyoapp\.com""")
@ -297,12 +307,7 @@ abstract class Keyoapp(
protected open fun Element.getImageUrl(selector: String): String? { protected open fun Element.getImageUrl(selector: String): String? {
return this.selectFirst(selector)?.let { element -> return this.selectFirst(selector)?.let { element ->
element.attr("style") IMG_REGEX.find(element.attr("style"))?.groups?.get("url")?.value
.substringAfter(":url(", "")
.substringBefore(")", "")
.takeIf { it.isNotEmpty() }
?.toHttpUrlOrNull()?.newBuilder()?.setQueryParameter("w", "480")?.build()
?.toString()
} }
} }
@ -360,5 +365,8 @@ abstract class Keyoapp(
companion object { companion object {
private const val SHOW_PAID_CHAPTERS_PREF = "pref_show_paid_chap" private const val SHOW_PAID_CHAPTERS_PREF = "pref_show_paid_chap"
private const val SHOW_PAID_CHAPTERS_DEFAULT = false private const val SHOW_PAID_CHAPTERS_DEFAULT = false
val CDN_HOST_REGEX = """realUrl\s*=\s*`[^`]+//(?<host>[^/]+)""".toRegex()
val CDN_CLEAN_REGEX = """\$\{[^}]*\}""".toRegex()
val IMG_REGEX = """url\(['"]?(?<url>[^(['"\)])]+)""".toRegex()
} }
} }

View File

@ -9,6 +9,4 @@ class ArvenComics : Keyoapp(
) { ) {
// migrated from Mangathemesia to Keyoapp // migrated from Mangathemesia to Keyoapp
override val versionId = 2 override val versionId = 2
override val cdnUrl = "https://3xfsjdlc.is1.buzz/uploads"
} }

View File

@ -9,6 +9,4 @@ class EZmanga : Keyoapp(
) { ) {
// Migrated from Madara to Keyoapp // Migrated from Madara to Keyoapp
override val versionId = 2 override val versionId = 2
override val cdnUrl = "https://3xfsjdlc.is1.buzz/uploads"
} }

View File

@ -9,6 +9,4 @@ class LuaScans : Keyoapp(
) { ) {
// migrated from MangaThemesia to Keyoapp // migrated from MangaThemesia to Keyoapp
override val versionId = 2 override val versionId = 2
override val cdnUrl = "https://3xfsjdlc.is1.buzz/uploads"
} }

View File

@ -15,12 +15,9 @@ class MagusManga : Keyoapp(
) { ) {
override val versionId = 2 override val versionId = 2
override val cdnUrl = "https://3xfsjdlc.is1.buzz/uploads"
override val client = network.cloudflareClient.newBuilder() override val client = network.cloudflareClient.newBuilder()
.addInterceptor(::captchaInterceptor) .addInterceptor(::captchaInterceptor)
.rateLimitHost(baseUrl.toHttpUrl(), 1) .rateLimitHost(baseUrl.toHttpUrl(), 1)
.rateLimitHost(cdnUrl.toHttpUrl(), 1)
.build() .build()
private fun captchaInterceptor(chain: Interceptor.Chain): Response { private fun captchaInterceptor(chain: Interceptor.Chain): Response {

View File

@ -6,6 +6,4 @@ class NecroScans : Keyoapp(
"Necro Scans", "Necro Scans",
"https://necroscans.com", "https://necroscans.com",
"en", "en",
) { )
override val cdnUrl = "https://3xfsjdlc.is1.buzz/uploads"
}

View File

@ -6,6 +6,4 @@ class RezoScans : Keyoapp(
"Rezo Scans", "Rezo Scans",
"https://rezoscans.com", "https://rezoscans.com",
"en", "en",
) { )
override val cdnUrl = "https://3xfsjdlc.is1.buzz/uploads"
}

View File

@ -2,8 +2,8 @@ ext {
extName = 'Wicked Scans' extName = 'Wicked Scans'
extClass = '.WickedScans' extClass = '.WickedScans'
themePkg = 'keyoapp' themePkg = 'keyoapp'
baseUrl = 'https://rudrascans.com' baseUrl = 'https://wickedscans.org'
overrideVersionCode = 0 overrideVersionCode = 1
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -2,4 +2,4 @@ package eu.kanade.tachiyomi.extension.en.wickedscans
import eu.kanade.tachiyomi.multisrc.keyoapp.Keyoapp import eu.kanade.tachiyomi.multisrc.keyoapp.Keyoapp
class WickedScans : Keyoapp("Wicked Scans", "https://wickedscans.com", "en") class WickedScans : Keyoapp("Wicked Scans", "https://wickedscans.org", "en")

View File

@ -10,6 +10,4 @@ class ReaperScans : Keyoapp(
// Migrated from Madara to Keyoapp. // Migrated from Madara to Keyoapp.
override val versionId = 4 override val versionId = 4
override val cdnUrl = "https://3xfsjdlc.is1.buzz/uploads"
} }