HiveScans/Toons: Fix PageListParse (#7640)
* Fix PageListParse * change to json
This commit is contained in:
parent
a670f5d4ec
commit
54ca7ab4a3
@ -3,7 +3,7 @@ ext {
|
||||
extClass = '.HiveScans'
|
||||
themePkg = 'iken'
|
||||
baseUrl = 'https://hivetoon.com'
|
||||
overrideVersionCode = 36
|
||||
overrideVersionCode = 37
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
||||
|
@ -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")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user