# TODO: Clean this up and write comments.
def convert_tweets(tweets):
recent_tweets = tweets
outtweets = []
for tweet in recent_tweets:
try:
outtweets.insert(0, {
'id':str(tweet.id_str),
'date':str(tweet.created_at),
'retweet':('RT @' in tweet.text),
'text':str(tweet.text.encode('utf-8'))[1:],
'hashtags':tweet.entities.get('hashtags'),
'mentions':tweet.entities.get('user_metions'),
'reply':(tweet.in_reply_to_status_id_str)
})
except:
'retweet':('RT @' in tweet.full_text),
'text':str(tweet.full_text.encode('utf-8'))[1:],
'retweet':True,
'text':str(tweet.retweeted_status.text.encode("utf-8"))[1:],
return outtweets