mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-01-18 16:40:41 -06:00
Fixed a bug with URLS in complex tweets
This commit is contained in:
parent
990ddf64f5
commit
d50e8e2798
@ -58,10 +58,11 @@ def compose_tweet(tweet, db, relative_times):
|
|||||||
else:
|
else:
|
||||||
text = "RT @%s: %s" % (tweet["retweeted_status"]["user"]["screen_name"], StripChars(tweet[value]))
|
text = "RT @%s: %s" % (tweet["retweeted_status"]["user"]["screen_name"], StripChars(tweet[value]))
|
||||||
if text[-1] in chars: text=text+"."
|
if text[-1] in chars: text=text+"."
|
||||||
urls = utils.find_urls_in_text(text)
|
if tweet.has_key("message") == False:
|
||||||
for url in range(0, len(urls)):
|
urls = utils.find_urls_in_text(text)
|
||||||
try: text = text.replace(urls[url], tweet["entities"]["urls"][url]["expanded_url"])
|
for url in range(0, len(urls)):
|
||||||
except IndexError: pass
|
try: text = text.replace(urls[url], tweet["entities"]["urls"][url]["expanded_url"])
|
||||||
|
except IndexError: pass
|
||||||
if config.app['app-settings']['handle_longtweets']: pass
|
if config.app['app-settings']['handle_longtweets']: pass
|
||||||
# return [user+", ", text, ts+", ", source]
|
# return [user+", ", text, ts+", ", source]
|
||||||
return [user+", ", text, ts+", ", source]
|
return [user+", ", text, ts+", ", source]
|
||||||
@ -75,7 +76,10 @@ def compose_quoted_tweet(quoted_tweet, original_tweet):
|
|||||||
except KeyError: text = "%s" % (StripChars(quoted_tweet["text"]))
|
except KeyError: text = "%s" % (StripChars(quoted_tweet["text"]))
|
||||||
if text[-1] in chars: text=text+"."
|
if text[-1] in chars: text=text+"."
|
||||||
original_user = original_tweet["user"]["screen_name"]
|
original_user = original_tweet["user"]["screen_name"]
|
||||||
original_text = StripChars(original_tweet["text"])
|
if original_tweet.has_key("message"):
|
||||||
|
original_text = StripChars(original_tweet["message"])
|
||||||
|
else:
|
||||||
|
original_text = StripChars(original_tweet["text"])
|
||||||
try: original_text = "rt @%s: %s" % (original_tweet["retweeted_status"]["user"]["screen_name"], StripChars(original_tweet["retweeted_status"]["text"]))
|
try: original_text = "rt @%s: %s" % (original_tweet["retweeted_status"]["user"]["screen_name"], StripChars(original_tweet["retweeted_status"]["text"]))
|
||||||
except KeyError: original_text = "%s" % (StripChars(original_tweet["text"]))
|
except KeyError: original_text = "%s" % (StripChars(original_tweet["text"]))
|
||||||
quoted_tweet["message"] = _(u"{0}. Quoted tweet from @{1}: {2}").format( quoted_tweet["text"], original_user, original_text)
|
quoted_tweet["message"] = _(u"{0}. Quoted tweet from @{1}: {2}").format( quoted_tweet["text"], original_user, original_text)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user