Catch image description sent by Streaming API. Should be enough to fix #449

This commit is contained in:
Manuel Cortez 2022-01-25 01:27:52 -06:00
parent c048c3ff32
commit e43ddad678
No known key found for this signature in database
GPG Key ID: 262CC30FA01B5CBF

View File

@ -45,6 +45,10 @@ def process_image_descriptions(entities):
for media in entities["media"]: for media in entities["media"]:
if media.get("ext_alt_text") != None: if media.get("ext_alt_text") != None:
image_descriptions.append(media.get("ext_alt_text")) image_descriptions.append(media.get("ext_alt_text"))
# Tweets retrieved via the Streaming API have a description field in media photos with image description available.
elif media.get("description") != None:
image_descriptions.append(media.get("description"))
idescriptions = "" idescriptions = ""
for image in image_descriptions: for image in image_descriptions:
idescriptions += _("Image description: {}.").format(image) idescriptions += _("Image description: {}.").format(image)