From 56201f16bdc18cc566f7b94700bb06aad99fc212 Mon Sep 17 00:00:00 2001 From: Yomguithereal Date: Wed, 3 Feb 2021 13:15:55 +0100 Subject: [PATCH] Fixing issue when quoted tweet is not present in payload --- minet/twitter/api_scraper.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/minet/twitter/api_scraper.py b/minet/twitter/api_scraper.py index 9553a88fb3..3e918b39d6 100644 --- a/minet/twitter/api_scraper.py +++ b/minet/twitter/api_scraper.py @@ -142,13 +142,15 @@ def process_single_tweet(tweet_id, tweet_index, user_index): # Quoted? quoted_id = tweet.get('quoted_status_id_str') - if quoted_id: + # TODO: sometimes tweet is not present + if quoted_id and quoted_id in tweet_index: tweet['quoted_status'] = process_single_tweet(quoted_id, tweet_index, user_index) # Retweeted? retweeted_id = tweet.get('retweeted_status_id_str') - if retweeted_id: + # TODO: sometimes tweet is not present + if retweeted_id and retweeted_id in tweet_index: tweet['retweeted_status'] = process_single_tweet(retweeted_id, tweet_index, user_index) return tweet