some improvements in long tweets

This commit is contained in:
2016-04-28 13:54:06 -05:00
parent a312b7f63c
commit 2268619101
7 changed files with 46 additions and 33 deletions

View File

@@ -169,10 +169,14 @@ class viewTweet(basicTweet):
image_description = []
text = ""
for i in xrange(0, len(tweetList)):
if tweetList[i].has_key("retweeted_status"):
text = text + "rt @%s: %s\n" % (tweetList[i]["retweeted_status"]["user"]["screen_name"], tweetList[i]["retweeted_status"]["text"])
if tweetList[i].has_key("message"):
value = "message"
else:
text = text + "@%s: %s\n" % (tweetList[i]["user"]["screen_name"], tweetList[i]["text"])
value = "text"
if tweetList[i].has_key("retweeted_status"):
text = text + "rt @%s: %s\n" % (tweetList[i]["retweeted_status"]["user"]["screen_name"], tweetList[i]["retweeted_status"][value])
else:
text = text + "@%s: %s\n" % (tweetList[i]["user"]["screen_name"], tweetList[i][value])
if tweetList[i].has_key("extended_entities") and tweetList[i]["extended_entities"].has_key("media"):
for z in tweetList[i]["extended_entities"]["media"]:
if z.has_key("ext_alt_text") and z["ext_alt_text"] != None:
@@ -181,10 +185,14 @@ class viewTweet(basicTweet):
favs_count = str(tweet["favorite_count"])
source = str(re.sub(r"(?s)<.*?>", "", tweet["source"].encode("utf-8")))
if text == "":
if tweet.has_key("message"):
value = "message"
else:
value = "text"
if tweet.has_key("retweeted_status"):
text = "rt @%s: %s" % (tweet["retweeted_status"]["user"]["screen_name"], tweet["retweeted_status"]["text"])
else:
text = tweet["text"]
text = tweet[value]
text = self.clear_text(text)
if tweet.has_key("extended_entities") and tweet["extended_entities"].has_key("media"):
for z in tweet["extended_entities"]["media"]: