Changed way of detecting quoted statuses. Parsing improvements in tweet displayer

This commit is contained in:
2016-06-27 09:44:36 -05:00
parent b1cf1c5590
commit da39f40048
5 changed files with 20 additions and 20 deletions

View File

@@ -267,9 +267,8 @@ class baseBufferController(bufferController):
l = tweets.is_long(tweet)
while l != False:
tweetsList.append(tweet)
id = tweets.get_id(l)
try:
tweet = self.session.twitter.twitter.show_status(id=id, include_ext_alt_text=True)
tweet = self.session.twitter.twitter.show_status(id=l, include_ext_alt_text=True)
urls = utils.find_urls_in_text(tweet["text"])
for url in range(0, len(urls)):
try: tweet["text"] = tweet["text"].replace(urls[url], tweet["entities"]["urls"][url]["expanded_url"])

View File

@@ -174,12 +174,15 @@ class viewTweet(basicTweet):
text = ""
for i in xrange(0, len(tweetList)):
# tweets with message keys are longer tweets, the message value is the full messaje taken from twishort.
if tweetList[i].has_key("message"):
if tweetList[i].has_key("message") and tweetList[i]["is_quote_status"] == False:
value = "message"
else:
value = "text"
if tweetList[i].has_key("retweeted_status"):
text = text + "rt @%s: %s\n" % (tweetList[i]["retweeted_status"]["user"]["screen_name"], tweetList[i][value])
if tweetList[i].has_key("retweeted_status") and tweetList[i]["is_quote_status"] == False:
if tweetList[i].has_key("message") == False:
text = text + "rt @%s: %s\n" % (tweetList[i]["retweeted_status"]["user"]["screen_name"], tweetList[i]["retweeted_status"]["text"])
else:
text = text + "rt @%s: %s\n" % (tweetList[i]["retweeted_status"]["user"]["screen_name"], tweetList[i][value])
else:
text = text + "@%s: %s\n" % (tweetList[i]["user"]["screen_name"], tweetList[i][value])
# tweets with extended_entities could include image descriptions.
@@ -198,7 +201,10 @@ class viewTweet(basicTweet):
else:
value = "text"
if tweet.has_key("retweeted_status"):
text = "rt @%s: %s" % (tweet["retweeted_status"]["user"]["screen_name"], tweet[value])
if tweet.has_key("message") == False:
text = "rt @%s: %s" % (tweet["retweeted_status"]["user"]["screen_name"], tweet["retweeted_status"]["text"])
else:
text = "rt @%s: %s" % (tweet["retweeted_status"]["user"]["screen_name"], tweet[value])
else:
text = tweet[value]
text = self.clear_text(text)