mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-07-18 06:06:06 -04:00
Improvements in quoted tweets handling. Closes #190
This commit is contained in:
@@ -19,8 +19,10 @@
|
||||
from twitter import utils
|
||||
|
||||
def is_long(tweet):
|
||||
if tweet.has_key("quoted_status_id") and tweet["quoted_status_id"] != None:
|
||||
if tweet.has_key("quoted_status_id") and tweet.has_key("quoted_status"):
|
||||
return tweet["quoted_status_id"]
|
||||
elif tweet.has_key("retweeted_status") and tweet["retweeted_status"].has_key("quoted_status_id") and tweet["retweeted_status"].has_key("quoted_status"):
|
||||
return tweet["retweeted_status"]["quoted_status_id"]
|
||||
return False
|
||||
|
||||
def clear_url(tweet):
|
||||
@@ -33,6 +35,8 @@ def clear_url(tweet):
|
||||
except IndexError: pass
|
||||
try:
|
||||
tweet["entities"]["urls"].remove(tweet["entities"]["urls"][-1])
|
||||
except ValueError:
|
||||
except IndexError:
|
||||
tweet["retweeted_status"]["entities"]["urls"].remove(tweet["retweeted_status"]["entities"]["urls"][-1])
|
||||
else:
|
||||
pass
|
||||
return tweet
|
Reference in New Issue
Block a user