Fixed a bug in long tweet parsing. Fixes #103

This commit is contained in:
Manuel Cortez 2017-01-24 08:15:49 -06:00
parent fedf153252
commit 05a4e9b6e4
2 changed files with 12 additions and 2 deletions

View File

@ -2,6 +2,10 @@
## changes in this version
* Fixed a bug in long tweet parsing that was making TWBlue to disconnect the streaming API. [#103](https://github.com/manuelcortez/TWBlue/issues/103)
## Changes in version 0.88 and 0.89
* Fixed more issues with streams and reconnections.
* newer updates will indicate the release date in the updater.
* Changes to keystrokes are reflected in keystroke editor automatically.

View File

@ -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):