From 3095ce305459b40bd60d73ba6ee84d834449fd21 Mon Sep 17 00:00:00 2001 From: msramalho <19508417+msramalho@users.noreply.github.com> Date: Mon, 4 Jul 2022 18:25:33 +0200 Subject: [PATCH] fix: missing key bug --- archivers/twitter_archiver.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/archivers/twitter_archiver.py b/archivers/twitter_archiver.py index 08f7118..1c1b173 100644 --- a/archivers/twitter_archiver.py +++ b/archivers/twitter_archiver.py @@ -75,8 +75,9 @@ class TwitterArchiver(Archiver): urls.append(p["url"]) # 1 tweet has 1 video max - v = tweet["video"] - urls.append(self.choose_variant(v.get("variants", []))) + if "video" in tweet: + v = tweet["video"] + urls.append(self.choose_variant(v.get("variants", []))) logger.debug(f"Twitter hack got {urls=}")