mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-03-14 09:28:03 -06:00
Fix name changes from automatic conversion.
This commit is contained in:
parent
b9ce127bc1
commit
885829a930
@ -32,18 +32,18 @@ def get_twishort_uri(url):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def is_long(tweet):
|
def is_long(tweet):
|
||||||
long = False
|
longtw = False
|
||||||
for url in range(0, len(tweet["entities"]["urls"])):
|
for url in range(0, len(tweet["entities"]["urls"])):
|
||||||
try:
|
try:
|
||||||
if tweet["entities"]["urls"][url] != None and "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"])
|
longtw = get_twishort_uri(tweet["entities"]["urls"][url]["expanded_url"])
|
||||||
except IndexError:
|
except IndexError:
|
||||||
pass
|
pass
|
||||||
# sometimes Twitter returns URL's with None objects, so let's take it.
|
# sometimes Twitter returns URL's with None objects, so let's take it.
|
||||||
# see https://github.com/manuelcortez/TWBlue/issues/103
|
# see https://github.com/manuelcortez/TWBlue/issues/103
|
||||||
except TypeError:
|
except TypeError:
|
||||||
pass
|
pass
|
||||||
if int == False and "retweeted_status" in tweet:
|
if not longtw and "retweeted_status" in tweet:
|
||||||
for url in range(0, len(tweet["retweeted_status"]["entities"]["urls"])):
|
for url in range(0, len(tweet["retweeted_status"]["entities"]["urls"])):
|
||||||
try:
|
try:
|
||||||
if tweet["retweeted_status"]["entities"]["urls"][url] != None and "twishort.com" in tweet["retweeted_status"]["entities"]["urls"][url]["expanded_url"]:
|
if tweet["retweeted_status"]["entities"]["urls"][url] != None and "twishort.com" in tweet["retweeted_status"]["entities"]["urls"][url]["expanded_url"]:
|
||||||
@ -52,7 +52,7 @@ def is_long(tweet):
|
|||||||
pass
|
pass
|
||||||
except TypeError:
|
except TypeError:
|
||||||
pass
|
pass
|
||||||
return int
|
return longtw
|
||||||
|
|
||||||
def get_full_text(uri):
|
def get_full_text(uri):
|
||||||
try:
|
try:
|
||||||
@ -85,5 +85,4 @@ def create_tweet(user_token, user_secret, text, media=0):
|
|||||||
try:
|
try:
|
||||||
return response.json()["text_to_tweet"]
|
return response.json()["text_to_tweet"]
|
||||||
except:
|
except:
|
||||||
print("There was a problem creating a long tweet")
|
log.exception("There was a problem creating a long tweet.")
|
||||||
return 0
|
|
@ -475,9 +475,9 @@ class Session(object):
|
|||||||
return compose.compose_quoted_tweet(quoted_tweet, original_tweet)
|
return compose.compose_quoted_tweet(quoted_tweet, original_tweet)
|
||||||
|
|
||||||
def check_long_tweet(self, tweet):
|
def check_long_tweet(self, tweet):
|
||||||
long = twishort.is_long(tweet)
|
longtw = twishort.is_long(tweet)
|
||||||
if int != False and config.app["app-settings"]["handle_longtweets"]:
|
if longtw and config.app["app-settings"]["handle_longtweets"]:
|
||||||
tweet["message"] = twishort.get_full_text(int)
|
tweet["message"] = twishort.get_full_text(longtw)
|
||||||
if tweet["message"] == False: return False
|
if tweet["message"] == False: return False
|
||||||
tweet["twishort"] = True
|
tweet["twishort"] = True
|
||||||
for i in tweet["entities"]["user_mentions"]:
|
for i in tweet["entities"]["user_mentions"]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user