Browse Source

Not fail on non-valid gallery images

master
blank X 2 years ago
parent
commit
43d3920023
  1. 9
      redditbot.py

9
redditbot.py

@ -298,11 +298,12 @@ async def main():
files = []
captions = []
for a, i in enumerate(random_post.media_metadata):
captions.append(f'{text}\n#{a + 1}')
filename = os.path.join(tempdir, str(time.time()))
i = random_post.media_metadata[i]
await _download_file(filename, i['s']['u'])
files.append(filename)
if i['status'] == 'valid':
filename = os.path.join(tempdir, str(time.time()))
await _download_file(filename, i['s']['u'])
captions.append(f'{text}\n#{a + 1}')
files.append(filename)
url = None
if url:
parsed = list(urlparse(url))

Loading…
Cancel
Save