Fixed extended retweets in Streaming API. Closes #174

This commit is contained in:
Manuel Cortez 2017-11-08 09:43:12 -06:00
parent 68ea029fe3
commit ed7c9802d1
3 changed files with 11 additions and 8 deletions

View File

@ -6,7 +6,7 @@
* In the translator module, the list of available languages is fetched automatically from the provider. That means all of these languages will work and there will not be inconsistencies. Also we've removed the first combo box, because the language is detected automatically by Yandex'S API. ([#153](https://github.com/manuelcortez/TWBlue/issues/153)) * In the translator module, the list of available languages is fetched automatically from the provider. That means all of these languages will work and there will not be inconsistencies. Also we've removed the first combo box, because the language is detected automatically by Yandex'S API. ([#153](https://github.com/manuelcortez/TWBlue/issues/153))
* Trending topics, searches and conversation buffers will use mute settings set for the session in wich they were opened. ([#157](https://github.com/manuelcortez/TWBlue/issues/157)) * Trending topics, searches and conversation buffers will use mute settings set for the session in wich they were opened. ([#157](https://github.com/manuelcortez/TWBlue/issues/157))
* The Tweet limit is now 280 characters lenght instead 140. It means you can tweet longer tweets. ([#172](https://github.com/manuelcortez/TWBlue/issues/172)) * The Tweet limit is now 280 characters lenght instead 140. It means you can tweet longer tweets. ([#172](https://github.com/manuelcortez/TWBlue/issues/172))
* And more. ([#156,](https://github.com/manuelcortez/TWBlue/issues/156) [#163,](https://github.com/manuelcortez/TWBlue/issues/163) [#159,](https://github.com/manuelcortez/TWBlue/issues/159) [#173,](https://github.com/manuelcortez/TWBlue/issues/173)) * And more. ([#156,](https://github.com/manuelcortez/TWBlue/issues/156) [#163,](https://github.com/manuelcortez/TWBlue/issues/163) [#159,](https://github.com/manuelcortez/TWBlue/issues/159) [#173,](https://github.com/manuelcortez/TWBlue/issues/173) [#174,](https://github.com/manuelcortez/TWBlue/issues/174))
## changes in version 0.91 and 0.92 ## changes in version 0.91 and 0.92

View File

@ -60,12 +60,12 @@ class timelinesStreamer(TwythonStreamer):
self.friends = friends self.friends = friends
def on_success(self, data): def on_success(self, data):
# try:
if "text" in data and utils.is_allowed(data, self.session.settings["twitter"]["ignored_clients"]) == True: if "text" in data and utils.is_allowed(data, self.session.settings["twitter"]["ignored_clients"]) == True:
if data.has_key("extended_tweet"): if data.has_key("extended_tweet"):
data["full_text"] = data["extended_tweet"]["full_text"] data["full_text"] = data["extended_tweet"]["full_text"]
# data["entities"] = data["extended_tweet"]["entities"] if data.has_key("retweeted_status"):
# log.error(data["extended_entities"]) if data["retweeted_status"].has_key("extended_tweet"):
data["retweeted_status"]["full_text"] = data["retweeted_status"]["extended_tweet"]["full_text"]
data["full_text"] = data["text"]
data["retweeted_status"]["entities"] = data["retweeted_status"]["extended_tweet"]["entities"]
self.check_tls(data) self.check_tls(data)
# except:
# pass

View File

@ -132,8 +132,11 @@ class streamer(TwythonStreamer):
if data.has_key("extended_tweet"): if data.has_key("extended_tweet"):
data["full_text"] = data["extended_tweet"]["full_text"] data["full_text"] = data["extended_tweet"]["full_text"]
data["entities"] = data["extended_tweet"]["entities"] data["entities"] = data["extended_tweet"]["entities"]
# log.error(data["extended_tweet"]) if data.has_key("retweeted_status"):
# log.error("Extended tweet") if data["retweeted_status"].has_key("extended_tweet"):
data["retweeted_status"]["full_text"] = data["retweeted_status"]["extended_tweet"]["full_text"]
data["full_text"] = data["text"]
data["retweeted_status"]["entities"] = data["retweeted_status"]["extended_tweet"]["entities"]
if data["user"]["id"] in self.muted_users: return if data["user"]["id"] in self.muted_users: return
self.check_mentions(data) self.check_mentions(data)
self.check_send(data) self.check_send(data)