mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-29 22:23:12 -06:00
Handle Twyshort's detection for reduced tweets
This commit is contained in:
parent
062289a977
commit
818bc243e4
@ -39,6 +39,7 @@ def get_twishort_uri(url):
|
|||||||
def is_long(tweet):
|
def is_long(tweet):
|
||||||
""" Check if the passed tweet is made with Twishort.
|
""" Check if the passed tweet is made with Twishort.
|
||||||
returns True if is a long tweet, False otherwise."""
|
returns True if is a long tweet, False otherwise."""
|
||||||
|
if hasattr(tweet, "entities") and tweet.entities.get("urls"):
|
||||||
long = False
|
long = False
|
||||||
for url in range(0, len(tweet.entities["urls"])):
|
for url in range(0, len(tweet.entities["urls"])):
|
||||||
try:
|
try:
|
||||||
@ -51,14 +52,7 @@ def is_long(tweet):
|
|||||||
except TypeError:
|
except TypeError:
|
||||||
pass
|
pass
|
||||||
if long == False and hasattr(tweet, "retweeted_status"):
|
if long == False and hasattr(tweet, "retweeted_status"):
|
||||||
for url in range(0, len(tweet.retweeted_status.entities["urls"])):
|
return is_long(tweet.retweeted_status)
|
||||||
try:
|
|
||||||
if tweet.retweeted_status.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
|
return long
|
||||||
|
|
||||||
def get_full_text(uri):
|
def get_full_text(uri):
|
||||||
|
Loading…
Reference in New Issue
Block a user