Play a sound when a tweet contains images

This commit is contained in:
2017-01-07 06:58:53 -06:00
parent cc60235503
commit 146667144a
4 changed files with 11 additions and 1 deletions

View File

@@ -66,6 +66,14 @@ def is_geocoded(tweet):
if tweet.has_key("coordinates") and tweet["coordinates"] != None:
return True
def is_media(tweet):
if tweet["entities"].has_key("media") == False:
return False
for i in tweet["entities"]["media"]:
if i.has_key("type") and i["type"] == "photo":
return True
return False
def get_all_mentioned(tweet, conf, field="screen_name"):
""" Gets all users that has been mentioned."""
results = []