GenzToons: Actually update domain and cdn url (#5603)

* update cdn

* search cdn in page

* bruh i dont update the domain

* revert changes in keyoapp
This commit is contained in:
bapeey 2024-10-20 07:30:31 -05:00 committed by GitHub
parent 9ce8d7b961
commit 24c4747541
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 2 deletions

View File

@ -3,7 +3,7 @@ ext {
extClass = '.GenzToons'
themePkg = 'keyoapp'
baseUrl = 'https://genzupdates.com'
overrideVersionCode = 28
overrideVersionCode = 29
}
apply from: "$rootDir/common.gradle"

View File

@ -7,7 +7,9 @@ import androidx.preference.SwitchPreferenceCompat
import eu.kanade.tachiyomi.multisrc.keyoapp.Keyoapp
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import eu.kanade.tachiyomi.source.ConfigurableSource
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
@ -15,7 +17,7 @@ import uy.kohesive.injekt.api.get
class GenzToons :
Keyoapp(
"Genz Toons",
"https://genztoons.com",
"https://genzupdates.com",
"en",
),
ConfigurableSource {
@ -42,6 +44,16 @@ class GenzToons :
}
}
override fun pageListParse(document: Document): List<Page> {
val script = document.select("#pages > script").joinToString("\n") { it.data() }
val realCdnUrl = CDN_URL_REGEX.find(script)?.groupValues?.get(1)?.takeIf { it.startsWith("http") }
?: "$baseUrl/uploads/"
return document.select("#pages > img")
.mapIndexed { index, img ->
Page(index, document.location(), realCdnUrl + img.attr("uid"))
}
}
override fun setupPreferenceScreen(screen: PreferenceScreen) {
SwitchPreferenceCompat(screen.context).apply {
key = SHOW_PAID_CHAPTERS_PREF
@ -58,5 +70,6 @@ class GenzToons :
companion object {
private const val SHOW_PAID_CHAPTERS_PREF = "pref_show_paid_chap"
private const val SHOW_PAID_CHAPTERS_DEFAULT = false
private val CDN_URL_REGEX = """realUrl\s*=\s*`([^`]+)\$""".toRegex()
}
}