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 {
extName = 'Loading Artist'
extClass = '.LoadingArtist'
extVersionCode = 2
extVersionCode = 3
}
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.util.asJsoup
import kotlinx.serialization.Serializable
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.decodeFromJsonElement
import kotlinx.serialization.json.jsonObject
import okhttp3.Request
import okhttp3.Response
import rx.Observable
@ -89,9 +88,7 @@ class LoadingArtist : HttpSource() {
}
override fun chapterListParse(response: Response): List<SChapter> {
val comics = json.parseToJsonElement(response.body.string()).jsonObject.map {
json.decodeFromJsonElement<Comic>(it.value)
}
val comics = json.decodeFromString<List<Comic>>(response.body.string())
val validTypes = listOf("comic", "game", "art")
return comics.filter { validTypes.any { type -> it.section == type } }.map {
SChapter.create().apply {