fix(anilist): Fix null recommendation node
(cherry picked from commit 305f8db0adcf821962a539867b5704fbf229461e)
This commit is contained in:
parent
5ec780eddb
commit
d0823ef3f6
1 changed files with 16 additions and 10 deletions
|
|
@ -88,16 +88,22 @@ class AniListPagingSource(manga: Manga) : TrackerRecommendationPagingSource(
|
||||||
.ifEmpty { throw NoResultsException() }
|
.ifEmpty { throw NoResultsException() }
|
||||||
.filter()
|
.filter()
|
||||||
|
|
||||||
return media.flatMap { it.jsonObject["recommendations"]!!.jsonObject["edges"]!!.jsonArray }.map {
|
return media.flatMap { it.jsonObject["recommendations"]!!.jsonObject["edges"]!!.jsonArray }.mapNotNull { edge ->
|
||||||
val rec = it.jsonObject["node"]!!.jsonObject["mediaRecommendation"]!!.jsonObject
|
edge.jsonObject["node"]?.let { node ->
|
||||||
val recTitle = getTitle(rec)
|
node.jsonObject["mediaRecommendation"]?.takeIf { it is JsonObject }?.let { media ->
|
||||||
logcat { "ANILIST > RECOMMENDATION: $recTitle" }
|
val rec = media.jsonObject
|
||||||
SManga(
|
val recTitle = getTitle(rec)
|
||||||
title = recTitle,
|
logcat { "ANILIST > RECOMMENDATION: $recTitle" }
|
||||||
thumbnail_url = rec["coverImage"]!!.jsonObject["large"]!!.jsonPrimitive.content,
|
rec["siteUrl"]?.jsonPrimitive?.contentOrNull?.let { url ->
|
||||||
initialized = true,
|
SManga(
|
||||||
url = rec["siteUrl"]!!.jsonPrimitive.content,
|
title = recTitle,
|
||||||
)
|
thumbnail_url = rec["coverImage"]?.jsonObject?.get("large")?.jsonPrimitive?.contentOrNull,
|
||||||
|
initialized = true,
|
||||||
|
url = url,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue