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() }
|
||||
.filter()
|
||||
|
||||
return media.flatMap { it.jsonObject["recommendations"]!!.jsonObject["edges"]!!.jsonArray }.map {
|
||||
val rec = it.jsonObject["node"]!!.jsonObject["mediaRecommendation"]!!.jsonObject
|
||||
val recTitle = getTitle(rec)
|
||||
logcat { "ANILIST > RECOMMENDATION: $recTitle" }
|
||||
SManga(
|
||||
title = recTitle,
|
||||
thumbnail_url = rec["coverImage"]!!.jsonObject["large"]!!.jsonPrimitive.content,
|
||||
initialized = true,
|
||||
url = rec["siteUrl"]!!.jsonPrimitive.content,
|
||||
)
|
||||
return media.flatMap { it.jsonObject["recommendations"]!!.jsonObject["edges"]!!.jsonArray }.mapNotNull { edge ->
|
||||
edge.jsonObject["node"]?.let { node ->
|
||||
node.jsonObject["mediaRecommendation"]?.takeIf { it is JsonObject }?.let { media ->
|
||||
val rec = media.jsonObject
|
||||
val recTitle = getTitle(rec)
|
||||
logcat { "ANILIST > RECOMMENDATION: $recTitle" }
|
||||
rec["siteUrl"]?.jsonPrimitive?.contentOrNull?.let { url ->
|
||||
SManga(
|
||||
title = recTitle,
|
||||
thumbnail_url = rec["coverImage"]?.jsonObject?.get("large")?.jsonPrimitive?.contentOrNull,
|
||||
initialized = true,
|
||||
url = url,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue