blank X 2021-04-20 22:38:15 +07:00
parent e1fe1bba28
commit 3371eba487
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 5 additions and 1 deletions

View File

@ -282,7 +282,11 @@ async def main():
elif getattr(random_post, 'is_gallery', None):
files = []
captions = []
for a, i in enumerate(random_post.media_metadata):
if getattr(random_post, 'gallery_data', None):
gallery_keys = map(lambda i: i[1], sorted(map(lambda i: (i['id'], i['media_id']), random_post.gallery_data['items']), key=lambda i: i[0]))
else:
gallery_keys = random_post.media_metadata.keys()
for a, i in enumerate(gallery_keys):
i = random_post.media_metadata[i]
if i['status'] == 'valid':
filename = os.path.join(tempdir, str(time.time()))