From 7ef10b88f414f45b69165111db16c6df08346d57 Mon Sep 17 00:00:00 2001 From: Zed Date: Mon, 1 Jul 2019 23:48:33 +0200 Subject: [PATCH] Workaround for Twitter bug For some reason, reply threads with only "unavailable" tweets get the tag `ThreadedConversation--selfThread`, which is only meant to be used for replies that are actually part of the thread you're viewing. To fix this we simply only check "self" for the first reply. --- src/parser.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parser.nim b/src/parser.nim index da10d85..2741b01 100644 --- a/src/parser.nim +++ b/src/parser.nim @@ -102,11 +102,11 @@ proc parseConversation*(node: XmlNode): Conversation = let replies = node.select(".replies-to .stream-items") if replies == nil: return - for reply in replies.filterIt(it.kind != xnText): + for i, reply in replies.filterIt(it.kind != xnText): let class = reply.attr("class").toLower() let thread = reply.select(".stream-items") - if "self" in class: + if i == 0 and "self" in class: result.after = parseThread(thread) elif "lone" in class: result.replies.add parseThread(reply)