diff --git a/app/get_from_reddit.py b/app/get_from_reddit.py index 4f9d8e66..636b05f9 100644 --- a/app/get_from_reddit.py +++ b/app/get_from_reddit.py @@ -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