mirror of
				https://github.com/MCV-Software/TWBlue.git
				synced 2025-11-04 05:47:05 +00:00 
			
		
		
		
	Add image description from retweets. Fixes #119
This commit is contained in:
		@@ -2,11 +2,12 @@
 | 
			
		||||
 | 
			
		||||
## 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)
 | 
			
		||||
* Now OCR will work in images from retweets. It fixes a bug where TWBlue was detecting images but couldn't apply OCR on them. [#105](https://github.com/manuelcortez/TWBlue/issues/105)
 | 
			
		||||
* TWBlue won't try to load tweets already deleted, made with Twishort. Before, if someone posted a long tweet but deleted it in the Twishort's site, TWBlue was trying to load the tweet and it was causing problems in all the client. [#113](https://github.com/manuelcortez/TWBlue/issues/113)
 | 
			
		||||
* TWBlue shows an error message when you try to view the profile of a user that does not exist or has been suspended. [#114,](https://github.com/manuelcortez/TWBlue/issues/114) [#115](https://github.com/manuelcortez/TWBlue/issues/115)
 | 
			
		||||
* The spellchecker module should select the right language when is set to "user default". [#117](https://github.com/manuelcortez/TWBlue/issues/117)
 | 
			
		||||
* Fixed a bug in long tweet parsing that was making TWBlue to disconnect the streaming API. ([#103](https://github.com/manuelcortez/TWBlue/issues/103))
 | 
			
		||||
* Now OCR will work in images from retweets. It fixes a bug where TWBlue was detecting images but couldn't apply OCR on them. ([#105](https://github.com/manuelcortez/TWBlue/issues/105))
 | 
			
		||||
* TWBlue won't try to load tweets already deleted, made with Twishort. Before, if someone posted a long tweet but deleted it in the Twishort's site, TWBlue was trying to load the tweet and it was causing problems in all the client. ([#113](https://github.com/manuelcortez/TWBlue/issues/113))
 | 
			
		||||
* TWBlue shows an error message when you try to view the profile of an user that does not exist or has been suspended. ([#114,](https://github.com/manuelcortez/TWBlue/issues/114) [#115](https://github.com/manuelcortez/TWBlue/issues/115))
 | 
			
		||||
* The spellchecker module should select the right language when is set to "user default". ([#117](https://github.com/manuelcortez/TWBlue/issues/117))
 | 
			
		||||
* Image description will be displayed in retweets too. ([#119](https://github.com/manuelcortez/TWBlue/issues/119))
 | 
			
		||||
 | 
			
		||||
## Changes in version 0.88 and 0.89
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -219,6 +219,10 @@ class viewTweet(basicTweet):
 | 
			
		||||
     for z in tweetList[i]["extended_entities"]["media"]:
 | 
			
		||||
      if z.has_key("ext_alt_text") and z["ext_alt_text"] != None:
 | 
			
		||||
       image_description.append(z["ext_alt_text"])
 | 
			
		||||
    if tweetList[i].has_key("retweeted_status") and tweetList[i]["retweeted_status"].has_key("extended_entities") and tweetList[i]["retweeted_status"]["extended_entities"].has_key("media"):
 | 
			
		||||
     for z in tweetList[i]["retweeted_status"]["extended_entities"]["media"]:
 | 
			
		||||
      if z.has_key("ext_alt_text") and z["ext_alt_text"] != None:
 | 
			
		||||
       image_description.append(z["ext_alt_text"])
 | 
			
		||||
   # set rt and likes counters.
 | 
			
		||||
   rt_count = str(tweet["retweet_count"])
 | 
			
		||||
   favs_count = str(tweet["favorite_count"])
 | 
			
		||||
@@ -241,6 +245,10 @@ class viewTweet(basicTweet):
 | 
			
		||||
    for z in tweet["extended_entities"]["media"]:
 | 
			
		||||
     if z.has_key("ext_alt_text") and z["ext_alt_text"] != None:
 | 
			
		||||
      image_description.append(z["ext_alt_text"])
 | 
			
		||||
   if tweet.has_key("retweeted_status") and tweet["retweeted_status"].has_key("extended_entities") and tweet["retweeted_status"]["extended_entities"].has_key("media"):
 | 
			
		||||
    for z in tweet["retweeted_status"]["extended_entities"]["media"]:
 | 
			
		||||
     if z.has_key("ext_alt_text") and z["ext_alt_text"] != None:
 | 
			
		||||
      image_description.append(z["ext_alt_text"])
 | 
			
		||||
   self.message = message.viewTweet(text, rt_count, favs_count, source.decode("utf-8"))
 | 
			
		||||
   self.message.set_title(len(text))
 | 
			
		||||
   [self.message.set_image_description(i) for i in image_description]
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user