trying to fix some things
This commit is contained in:
parent
cef80eb5f0
commit
cc35888b62
|
@ -330,7 +330,7 @@ async def main():
|
|||
url = gfyitem.get('mp4Url', url)
|
||||
elif random_post.is_reddit_media_domain and splitted[1] == '.gif' and preview:
|
||||
preview = preview['images'][0]['variants']
|
||||
for i in ('mp4', 'gif'):
|
||||
for i in ('gif', 'mp4'):
|
||||
if i in preview:
|
||||
url = preview[i]['source']['url']
|
||||
break
|
||||
|
@ -338,7 +338,7 @@ async def main():
|
|||
url = urlunparse(urlparse(url, 'https'))
|
||||
await _download_file(filename, url)
|
||||
mimetype = await _get_file_mimetype(filename)
|
||||
if mimetype.startswith('image') and preview and preview['enabled']:
|
||||
if mimetype.startswith('image') and preview and preview.get('enabled'):
|
||||
preview = preview['images'][0]
|
||||
urls = [i['url'] for i in preview['resolutions']]
|
||||
urls.append(preview['source']['url'])
|
||||
|
|
Loading…
Reference in New Issue