Fix KeyError: 'u'
This commit is contained in:
parent
48ac10e1db
commit
9fcaaeb6cc
|
@ -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…
Reference in New Issue