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 Draff
parent ec2dcf0e7b
commit 01b431754f
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
2 changed files with 15 additions and 2 deletions

View File

@ -3,7 +3,7 @@ ext {
extClass = '.GenzToons' extClass = '.GenzToons'
themePkg = 'keyoapp' themePkg = 'keyoapp'
baseUrl = 'https://genzupdates.com' baseUrl = 'https://genzupdates.com'
overrideVersionCode = 28 overrideVersionCode = 29
} }
apply from: "$rootDir/common.gradle" 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.multisrc.keyoapp.Keyoapp
import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.network.interceptor.rateLimit
import eu.kanade.tachiyomi.source.ConfigurableSource import eu.kanade.tachiyomi.source.ConfigurableSource
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SChapter
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
@ -15,7 +17,7 @@ import uy.kohesive.injekt.api.get
class GenzToons : class GenzToons :
Keyoapp( Keyoapp(
"Genz Toons", "Genz Toons",
"https://genztoons.com", "https://genzupdates.com",
"en", "en",
), ),
ConfigurableSource { 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) { override fun setupPreferenceScreen(screen: PreferenceScreen) {
SwitchPreferenceCompat(screen.context).apply { SwitchPreferenceCompat(screen.context).apply {
key = SHOW_PAID_CHAPTERS_PREF key = SHOW_PAID_CHAPTERS_PREF
@ -58,5 +70,6 @@ class GenzToons :
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
private val CDN_URL_REGEX = """realUrl\s*=\s*`([^`]+)\$""".toRegex()
} }
} }