From 2327294af347c0d1781eee275064dac4a0587141 Mon Sep 17 00:00:00 2001 From: jeancf Date: Sat, 22 Jul 2023 10:46:59 +0200 Subject: [PATCH] Ignore timeline-item without tweet-link tag --- twoot.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/twoot.py b/twoot.py index 180cca1..6afc449 100755 --- a/twoot.py +++ b/twoot.py @@ -975,7 +975,12 @@ def main(argv): in_db_cnt = 0 for replied_to_tweet, status in timeline: # Extract tweet ID and status ID - tweet_id = status.find('a', class_='tweet-link').get('href').strip('#m') + tweet_link_tag = status.find('a', class_='tweet-link') + if tweet_link_tag is None: + logging.debug("Malformed timeline item (no tweet link), skipping") + continue + + tweet_id = tweet_link_tag.get('href').strip('#m') status_id = tweet_id.split('/')[3] logging.debug('processing tweet %s', tweet_id)