Fix KeyError: 'u'

master
blank X 2 years ago
parent 48ac10e1db
commit 9fcaaeb6cc
  1. 5
      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

Loading…
Cancel
Save