From 2895fc398df5ae860d42163a7f69962cd461a5d4 Mon Sep 17 00:00:00 2001 From: Samuel Clay Date: Thu, 26 May 2016 15:09:24 -0700 Subject: [PATCH] Adding photo category to tweets. --- utils/feed_fetcher.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/utils/feed_fetcher.py b/utils/feed_fetcher.py index 9dc5dcd63..0df5fda18 100644 --- a/utils/feed_fetcher.py +++ b/utils/feed_fetcher.py @@ -354,11 +354,16 @@ class FetchFeed: rss = feedgenerator.Atom1Feed(**data) for tweet in tweets: + categories = [] entities = "" + for media in tweet.entities.get('media', []): if 'media_url_https' not in media: continue if media['type'] == 'photo': entities += " " % media['media_url_https'] + if 'photo' not in categories: + categories.append('photo') + content = """
%s

%s
@@ -380,7 +385,6 @@ class FetchFeed: ("%s %s" % (tweet.retweet_count, "retweet" if tweet.retweet_count == 1 else "retweets")) if tweet.retweet_count else "", ) - categories = [] if tweet.in_reply_to_status_id: categories.append('reply') else: