HiveScans/Toons: Fix PageListParse (#7640)

* Fix PageListParse

* change to json
This commit is contained in:
Creepler13 2025-02-15 03:20:02 +01:00 committed by Draff
parent a670f5d4ec
commit 54ca7ab4a3
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
2 changed files with 23 additions and 1 deletions

View File

@ -3,7 +3,7 @@ ext {
extClass = '.HiveScans'
themePkg = 'iken'
baseUrl = 'https://hivetoon.com'
overrideVersionCode = 36
overrideVersionCode = 37
}
apply from: "$rootDir/common.gradle"

View File

@ -1,6 +1,12 @@
package eu.kanade.tachiyomi.extension.en.infernalvoidscans
import eu.kanade.tachiyomi.multisrc.iken.Iken
import eu.kanade.tachiyomi.source.model.Page
import kotlinx.serialization.Serializable
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
import okhttp3.Response
import uy.kohesive.injekt.injectLazy
class HiveScans : Iken(
"Hive Scans",
@ -8,6 +14,8 @@ class HiveScans : Iken(
"https://hivetoon.com",
) {
private val json by injectLazy<Json>()
override val versionId = 2
override val client = super.client.newBuilder()
@ -20,6 +28,20 @@ class HiveScans : Iken(
}
.build()
private val pageRegex = Regex("""\\"images\\":(\[.*?]).*?nextChapter""")
@Serializable
class PageDTO(
val url: String,
)
override fun pageListParse(response: Response): List<Page> {
val pageDataArray = pageRegex.find(response.body.string())?.destructured?.component1()?.replace("\\", "") ?: return listOf()
return json.decodeFromString<List<PageDTO>>(pageDataArray).mapIndexed { idx, page ->
Page(idx, imageUrl = page.url)
}
}
override fun headersBuilder() = super.headersBuilder()
.set("Cache-Control", "max-age=0")
}