diff --git a/src/parser.nim b/src/parser.nim index 2843236..2f4236e 100644 --- a/src/parser.nim +++ b/src/parser.nim @@ -588,7 +588,7 @@ proc parseGraphConversation*(js: JsonNode; tweetId: string): Conversation = else: result.replies.content.add thread elif entryId.startsWith("cursor-bottom"): - result.replies.bottom = e{"content", "value"}.getStr + result.replies.bottom = e.getCursor proc parseGraphTimeline*(js: JsonNode; root: string; after=""): Profile = result = Profile(tweets: Timeline(beginning: after.len == 0)) diff --git a/src/parserutils.nim b/src/parserutils.nim index 1d1fa15..786b326 100644 --- a/src/parserutils.nim +++ b/src/parserutils.nim @@ -48,7 +48,13 @@ template with*(ident; value: JsonNode; body): untyped = if notNull(value): body template getCursor*(js: JsonNode): string = - js{"content", "operation", "cursor", "value"}.getStr + var cursor = js{"content", "operation", "cursor", "value"} + if cursor.isNull: + cursor = js{"content", "value"} + if cursor.isNull: + cursor = js{"content", "itemContent", "value"} + + cursor.getStr template getError*(js: JsonNode): Error = if js.kind != JArray or js.len == 0: null