diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/MangaDexParser.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/MangaDexParser.kt index 1d891a40..db06ace9 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/site/MangaDexParser.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/site/MangaDexParser.kt @@ -247,7 +247,7 @@ internal class MangaDexParser(override val context: MangaLoaderContext) : MangaP val json = context.httpGet(url).parseJson() if (json.getString("result") == "ok") { return Chapters( - data = json.optJSONArray("data")?.filterIsInstance().orEmpty(), + data = json.optJSONArray("data")?.toJSONList().orEmpty(), total = json.getInt("total"), ) } else { diff --git a/src/main/kotlin/org/koitharu/kotatsu/parsers/util/json/JsonExt.kt b/src/main/kotlin/org/koitharu/kotatsu/parsers/util/json/JsonExt.kt index 04df05bf..9e429b3c 100644 --- a/src/main/kotlin/org/koitharu/kotatsu/parsers/util/json/JsonExt.kt +++ b/src/main/kotlin/org/koitharu/kotatsu/parsers/util/json/JsonExt.kt @@ -136,4 +136,8 @@ fun JSONArray?.isNullOrEmpty(): Boolean { } return this == null || this.length() == 0 +} + +fun JSONArray.toJSONList(): List { + return List(length()) { i -> getJSONObject(i) } } \ No newline at end of file