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'
|
extClass = '.HiveScans'
|
||||||
themePkg = 'iken'
|
themePkg = 'iken'
|
||||||
baseUrl = 'https://hivetoon.com'
|
baseUrl = 'https://hivetoon.com'
|
||||||
overrideVersionCode = 36
|
overrideVersionCode = 37
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
package eu.kanade.tachiyomi.extension.en.infernalvoidscans
|
package eu.kanade.tachiyomi.extension.en.infernalvoidscans
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.multisrc.iken.Iken
|
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(
|
class HiveScans : Iken(
|
||||||
"Hive Scans",
|
"Hive Scans",
|
||||||
@ -8,6 +14,8 @@ class HiveScans : Iken(
|
|||||||
"https://hivetoon.com",
|
"https://hivetoon.com",
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
private val json by injectLazy<Json>()
|
||||||
|
|
||||||
override val versionId = 2
|
override val versionId = 2
|
||||||
|
|
||||||
override val client = super.client.newBuilder()
|
override val client = super.client.newBuilder()
|
||||||
@ -20,6 +28,20 @@ class HiveScans : Iken(
|
|||||||
}
|
}
|
||||||
.build()
|
.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()
|
override fun headersBuilder() = super.headersBuilder()
|
||||||
.set("Cache-Control", "max-age=0")
|
.set("Cache-Control", "max-age=0")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user