add a .png if the image returns an imgur gallery

This commit is contained in:
Luke Robles 2020-09-16 11:37:28 -07:00
parent a9339aa579
commit 24d919fa56

View File

@ -45,5 +45,10 @@ def get_image(boards, nsfw=False):
if response['data']['domain'] not in domains:
# If we dont find an approved domain, re-try the request
return get_image(boards, nsfw=nsfw)
image_url = response['data']['url'].replace('http://', 'https://')
return response['data']['url'].replace('http://', 'https://')
if not image_url.endswith('png') or not image_url.endswith('jpg') not image_url.endswith('gif'):
image_url = image_url + '.png'
return image_url