From c8d1b96e3ff4ffcc54a941bc25ee1a3cd1ca669d Mon Sep 17 00:00:00 2001 From: Logan Williams Date: Thu, 31 Mar 2022 15:51:17 +0200 Subject: [PATCH] Fix bug in handling retweets without media --- cisticola/scraper/twitter.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cisticola/scraper/twitter.py b/cisticola/scraper/twitter.py index 43f6615..b44c794 100644 --- a/cisticola/scraper/twitter.py +++ b/cisticola/scraper/twitter.py @@ -37,10 +37,12 @@ class TwitterScraper(Scraper): if tweet.media: media_list += tweet.media - if tweet.retweetedTweet and tweet.retweetedTweet.media: + print(tweet.json()) + + if tweet.retweetedTweet and hasattr(tweet.retweetedTweet, 'media') and tweet.retweetedTweet.media: media_list += tweet.retweetedTweet.media - if tweet.quotedTweet and tweet.quotedTweet.media: + if tweet.quotedTweet and hasattr(tweet.quotedTweet, 'media') and tweet.quotedTweet.media: media_list += tweet.quotedTweet.media for media in media_list: