summaryrefslogtreecommitdiff
path: root/twitter.py
diff options
context:
space:
mode:
Diffstat (limited to 'twitter.py')
-rwxr-xr-xtwitter.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/twitter.py b/twitter.py
index 7f2dfae..87dfc68 100755
--- a/twitter.py
+++ b/twitter.py
@@ -103,22 +103,25 @@ def twitter(user):
logging.error('Request to twitter failed.', exc_info=exc)
return None
+ feed = {
+ 'title': 'Twitter: ' + user,
+ 'url': 'https://twitter.com/' + user,
+ 'description': 'The latest entries of the twitter account of ' + user,
+ 'content': []
+ }
+
if not response["meta"]["result_count"]:
- return []
+ return feed
- tweets = [parse_tweet(
+ feed['content'] = [parse_tweet(
user,
tweet,
response.get("includes", {}).get("tweets", []),
response.get("includes", {}).get("media", []),
) for tweet in response["data"]]
- return {
- 'title': 'Twitter: ' + user,
- 'url': 'https://twitter.com/' + user,
- 'description': 'The latest entries of the twitter account of ' + user,
- 'content': tweets
- }
+ return feed
+
def parse_tweet(user, tweet, included_tweets, included_media):
title = description = tweet["text"]