mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-01-18 16:40:41 -06:00
is_audio, is_geocoded, is_media, get_urls ignore dm's for now #215
This commit is contained in:
parent
7dad22189a
commit
019e83c55b
@ -22,6 +22,8 @@ def find_urls_in_text(text):
|
||||
return [s.strip(bad_chars) for s in url_re2.findall(text)]
|
||||
|
||||
def find_urls (tweet):
|
||||
if tweet.has_key("entities") == False:
|
||||
return []
|
||||
urls = []
|
||||
# Let's add URLS from tweet entities.
|
||||
for i in tweet["entities"]["urls"]:
|
||||
@ -72,6 +74,7 @@ def find_next_reply(id, listItem):
|
||||
return None
|
||||
|
||||
def is_audio(tweet):
|
||||
if tweet.has_key("entities") == False: return False
|
||||
try:
|
||||
if len(find_urls(tweet)) < 1:
|
||||
return False
|
||||
@ -88,6 +91,7 @@ def is_geocoded(tweet):
|
||||
return True
|
||||
|
||||
def is_media(tweet):
|
||||
if tweet.has_key("entities") == False: return False
|
||||
if tweet["entities"].has_key("media") == False:
|
||||
return False
|
||||
for i in tweet["entities"]["media"]:
|
||||
|
Loading…
x
Reference in New Issue
Block a user