Return expanded URLS when calling to find_urls

This commit is contained in:
Manuel Cortez 2017-09-17 23:19:04 -05:00
parent 348b8da619
commit d333b5f5c3

View File

@ -29,7 +29,12 @@ def find_urls (tweet):
i = "full_text" i = "full_text"
else: else:
i = "text" i = "text"
return [s[0] for s in url_re.findall(tweet[i])] shorten_urls = find_urls_in_text(tweet[i])
for url in range(0, len(shorten_urls)):
try:
urls.append(tweet["entities"]["urls"][url]["expanded_url"])
except: pass
return urls
def find_item(id, listItem): def find_item(id, listItem):
for i in range(0, len(listItem)): for i in range(0, len(listItem)):