fallback if thumbnail not present
This commit is contained in:
parent
0d8cbf6755
commit
6dc0c2c367
1 changed files with 8 additions and 3 deletions
|
@ -502,9 +502,14 @@ class PostItem(Gtk.ListBoxRow):
|
|||
return scaled_img
|
||||
|
||||
def get_oembed_thumb(self, oembed):
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue