LoadingArtist: Fix json parser (#3426)

Fix json parser
This commit is contained in:
Chopper 2024-06-06 03:33:30 -03:00 committed by GitHub
parent 21ee662448
commit 6e330faa35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 6 deletions

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'Loading Artist' extName = 'Loading Artist'
extClass = '.LoadingArtist' extClass = '.LoadingArtist'
extVersionCode = 2 extVersionCode = 3
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -10,9 +10,8 @@ import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.source.online.HttpSource
import eu.kanade.tachiyomi.util.asJsoup import eu.kanade.tachiyomi.util.asJsoup
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
import kotlinx.serialization.json.decodeFromJsonElement
import kotlinx.serialization.json.jsonObject
import okhttp3.Request import okhttp3.Request
import okhttp3.Response import okhttp3.Response
import rx.Observable import rx.Observable
@ -89,9 +88,7 @@ class LoadingArtist : HttpSource() {
} }
override fun chapterListParse(response: Response): List<SChapter> { override fun chapterListParse(response: Response): List<SChapter> {
val comics = json.parseToJsonElement(response.body.string()).jsonObject.map { val comics = json.decodeFromString<List<Comic>>(response.body.string())
json.decodeFromJsonElement<Comic>(it.value)
}
val validTypes = listOf("comic", "game", "art") val validTypes = listOf("comic", "game", "art")
return comics.filter { validTypes.any { type -> it.section == type } }.map { return comics.filter { validTypes.any { type -> it.section == type } }.map {
SChapter.create().apply { SChapter.create().apply {