mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-07-18 06:06:06 -04:00
Fixed a bug in long tweet parsing. Fixes #103
This commit is contained in:
@@ -33,17 +33,23 @@ def is_long(tweet):
|
||||
long = False
|
||||
for url in range(0, len(tweet["entities"]["urls"])):
|
||||
try:
|
||||
if "twishort.com" in tweet["entities"]["urls"][url]["expanded_url"]:
|
||||
if tweet["entities"]["urls"][url] != None and "twishort.com" in tweet["entities"]["urls"][url]["expanded_url"]:
|
||||
long = get_twishort_uri(tweet["entities"]["urls"][url]["expanded_url"])
|
||||
except IndexError:
|
||||
pass
|
||||
# sometimes Twitter returns URL's with None objects, so let's take it.
|
||||
# see https://github.com/manuelcortez/TWBlue/issues/103
|
||||
except TypeError:
|
||||
pass
|
||||
if long == False and tweet.has_key("retweeted_status"):
|
||||
for url in range(0, len(tweet["retweeted_status"]["entities"]["urls"])):
|
||||
try:
|
||||
if "twishort.com" in tweet["retweeted_status"]["entities"]["urls"][url]["expanded_url"]:
|
||||
if tweet["entities"]["urls"][url] != None and "twishort.com" in tweet["retweeted_status"]["entities"]["urls"][url]["expanded_url"]:
|
||||
long = get_twishort_uri(tweet["retweeted_status"]["entities"]["urls"][url]["expanded_url"])
|
||||
except IndexError:
|
||||
pass
|
||||
except TypeError:
|
||||
pass
|
||||
return long
|
||||
|
||||
def get_full_text(uri):
|
||||
|
Reference in New Issue
Block a user