diff --git a/redditbot.py b/redditbot.py index 138c068..a962db5 100644 --- a/redditbot.py +++ b/redditbot.py @@ -301,7 +301,10 @@ async def main(): i = random_post.media_metadata[i] if i['status'] == 'valid': filename = os.path.join(tempdir, str(time.time())) - await _download_file(filename, i['s']['u']) + for j in ('u', 'mp4', 'gif'): + if j in i['s']: + await _download_file(filename, i['s'][j]) + break captions.append(f'{text}\n#{a + 1}') files.append(filename) url = None