fallback if thumbnail not present

This commit is contained in:
Morgan McMillian 2021-02-24 20:36:16 -08:00
parent 0d8cbf6755
commit 6dc0c2c367

View file

@ -502,9 +502,14 @@ class PostItem(Gtk.ListBoxRow):
return scaled_img
def get_oembed_thumb(self, oembed):
url = oembed.thumbnail_url
old_width = oembed.thumbnail_width
old_height = oembed.thumbnail_height
if 'thumbnail_url' in oembed:
url = oembed.thumbnail_url
old_width = oembed.thumbnail_width
old_height = oembed.thumbnail_height
else:
url = oembed.url
old_width = oembed.width
old_height = oembed.height
ratio = old_width / old_height
new_height = 256 / ratio
r = requests.get(url)