Skip to content

Commit

Permalink
Fix parsing of pinned tombstone
Browse files Browse the repository at this point in the history
  • Loading branch information
zedeus committed Jul 10, 2023
1 parent e5b1f4b commit ef7c756
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/parser.nim
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,11 @@ proc parseGraphTweet(js: JsonNode): Tweet =
of "TweetUnavailable":
return Tweet()
of "TweetTombstone":
return Tweet(text: js{"tombstone", "text"}.getTombstone)
with text, js{"tombstone", "richText"}:
return Tweet(text: text.getTombstone)
with text, js{"tombstone", "text"}:
return Tweet(text: text.getTombstone)
return Tweet()
of "TweetPreviewDisplay":
return Tweet(text: "You're unable to view this Tweet because it's only available to the Subscribers of the account owner.")
of "TweetWithVisibilityResults":
Expand Down Expand Up @@ -486,12 +490,13 @@ proc parseGraphTimeline*(js: JsonNode; root: string; after=""): Profile =
elif entryId.startsWith("cursor-bottom"):
result.tweets.bottom = e{"content", "value"}.getStr
if after.len == 0 and i{"__typename"}.getStr == "TimelinePinEntry":
let entryId = i{"entry", "entryId"}.getEntryId
with tweetResult, i{"entry", "content", "content", "tweetResult", "result"}:
let tweet = parseGraphTweet(tweetResult)
tweet.pinned = true
if not tweet.available:
tweet.id = parseBiggestInt(entryId)
if not tweet.available and tweet.tombstone.len == 0:
let entryId = i{"entry", "entryId"}.getEntryId
if entryId.len > 0:
tweet.id = parseBiggestInt(entryId)
result.pinned = some tweet

proc parseGraphSearch*(js: JsonNode; after=""): Timeline =
Expand Down

0 comments on commit ef7c756

Please sign in to comment.