From d1a3e7ab5811c1114bd87680a79d0648eca97043 Mon Sep 17 00:00:00 2001 From: Zed Date: Sun, 23 Jan 2022 09:11:14 +0100 Subject: [PATCH] Fix empty pinned tweets when status wasn't found --- src/parser.nim | 9 ++++----- src/types.nim | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/parser.nim b/src/parser.nim index 755daf2..08c93d9 100644 --- a/src/parser.nim +++ b/src/parser.nim @@ -63,11 +63,6 @@ proc parseGraphListMembers*(js: JsonNode; cursor: string): Result[User] = if js.isNull: return - # result.top = js{"previous_cursor_str"}.getStr - # result.bottom = js{"next_cursor_str"}.getStr - # if result.bottom.len == 1: - # result.bottom.setLen 0 - let root = js{"data", "list", "members_timeline", "timeline", "instructions"} for instruction in root: if instruction{"type"}.getStr == "TimelineAddEntries": @@ -373,6 +368,10 @@ proc parseConversation*(js: JsonNode; tweetId: string): Conversation = result.replies.bottom = e.getCursor proc parseStatus*(js: JsonNode): Tweet = + with e, js{"errors"}: + if e.getError == tweetNotFound: + return + result = parseTweet(js) if not result.isNil: result.user = parseUser(js{"user"}) diff --git a/src/types.nim b/src/types.nim index 3ebbe0f..9a6ad7f 100644 --- a/src/types.nim +++ b/src/types.nim @@ -41,6 +41,7 @@ type rateLimited = 88 invalidToken = 89 listIdOrSlug = 112 + tweetNotFound = 144 forbidden = 200 badToken = 239 noCsrf = 353