diff --git a/src/en/arvenscans/build.gradle b/src/en/arvenscans/build.gradle index 90497b2b6..946293551 100644 --- a/src/en/arvenscans/build.gradle +++ b/src/en/arvenscans/build.gradle @@ -2,7 +2,7 @@ ext { extName = 'Vortex Scans' extClass = '.VortexScans' themePkg = 'iken' - overrideVersionCode = 35 + overrideVersionCode = 36 isNsfw = false } diff --git a/src/en/arvenscans/src/eu/kanade/tachiyomi/extension/en/arvenscans/VortexScans.kt b/src/en/arvenscans/src/eu/kanade/tachiyomi/extension/en/arvenscans/VortexScans.kt index fb8955dca..f987d6c25 100644 --- a/src/en/arvenscans/src/eu/kanade/tachiyomi/extension/en/arvenscans/VortexScans.kt +++ b/src/en/arvenscans/src/eu/kanade/tachiyomi/extension/en/arvenscans/VortexScans.kt @@ -1,9 +1,38 @@ package eu.kanade.tachiyomi.extension.en.arvenscans import eu.kanade.tachiyomi.multisrc.iken.Iken +import eu.kanade.tachiyomi.source.model.Page +import eu.kanade.tachiyomi.util.asJsoup +import kotlinx.serialization.decodeFromString +import kotlinx.serialization.json.Json +import kotlinx.serialization.json.jsonArray +import kotlinx.serialization.json.jsonObject +import kotlinx.serialization.json.jsonPrimitive +import okhttp3.Response +import uy.kohesive.injekt.injectLazy class VortexScans : Iken( "Vortex Scans", "en", "https://vortexscans.org", -) +) { + + private val json by injectLazy() + + private val regexImages = """\\"images\\":(.*?)\\"next""".toRegex() + + override fun pageListParse(response: Response): List { + val document = response.asJsoup() + + val images = document.selectFirst("script:containsData(images)") + ?.data() + ?.let { regexImages.find(it)!!.groupValues[1].trim(',') } + ?.let { json.decodeFromString("\"$it\"") } + ?.let { json.parseToJsonElement(it).jsonArray } + ?: throw Exception("Unable to parse images") + + return images.mapIndexed { idx, img -> + Page(idx, imageUrl = img.jsonObject["url"]!!.jsonPrimitive.content) + } + } +}