From 94c83f38114abaef10c36903fbcd59d78db7a578 Mon Sep 17 00:00:00 2001 From: Zed Date: Tue, 15 Apr 2025 02:06:00 +0100 Subject: [PATCH] Hide ads/promoted tweets Fixes #1234 --- src/parser.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parser.nim b/src/parser.nim index 6e0be73..01f0341 100644 --- a/src/parser.nim +++ b/src/parser.nim @@ -336,7 +336,7 @@ proc parseGraphThread(js: JsonNode): tuple[thread: Chain; self: bool] = let cursor = t{"item", "content", "value"} result.thread.cursor = cursor.getStr result.thread.hasMore = true - elif "tweet" in entryId: + elif "tweet" in entryId and "promoted" notin entryId: let isLegacy = t{"item"}.hasKey("itemContent") (contentKey, resultKey) = if isLegacy: ("itemContent", "tweet_results") @@ -381,7 +381,7 @@ proc parseGraphConversation*(js: JsonNode; tweetId: string; v2=true): Conversati let (thread, self) = parseGraphThread(e) if self: result.after = thread - else: + elif thread.content.len > 0: result.replies.content.add thread elif entryId.startsWith("tombstone"): let id = entryId.getId()