Fixing URL parsing in retweets

This commit is contained in:
Manuel Cortez 2017-12-10 07:53:03 -06:00
parent fd17d824be
commit 5a03cc80ca

View File

@ -62,12 +62,17 @@ def compose_tweet(tweet, db, relative_times, show_screen_names=False):
text = "RT @%s: %s" % (tweet["retweeted_status"]["user"]["screen_name"], text)
if tweet.has_key("message") == False:
urls = utils.find_urls_in_text(text)
if tweet.has_key("retweeted_status"):
for url in range(0, len(urls)):
try:
text = text.replace(urls[url], tweet["retweeted_status"]["entities"]["urls"][url]["expanded_url"])
except: pass
else:
for url in range(0, len(urls)):
try:
text = text.replace(urls[url], tweet["entities"]["urls"][url]["expanded_url"])
except: pass
if config.app['app-settings']['handle_longtweets']: pass
# return [user+", ", text, ts+", ", source]
return [user+", ", text, ts+", ", source]
def compose_dm(tweet, db, relative_times, show_screen_names=False):