1
0
mirror of https://github.com/instaloader/instaloader.git synced 2024-08-17 12:19:38 +02:00

Added ability to download videos within sidecars

Closes #41
This commit is contained in:
André Koch-Kramer 2017-08-25 13:39:23 +02:00
parent ca54088bdc
commit 1928db63bb

View File

@ -810,7 +810,7 @@ class Instaloader:
date=post.date, shortcode=post.shortcode)
os.makedirs(os.path.dirname(filename), exist_ok=True)
# Download the image(s) / video thumbnail
# Download the image(s) / video thumbnail and videos within sidecars if desired
if post.typename == 'GraphSidecar':
edge_number = 1
downloaded = True
@ -819,6 +819,12 @@ class Instaloader:
url=edge['node']['display_url'],
mtime=post.date,
filename_suffix=str(edge_number))
# Additionally download video if available and desired
if edge['node']['is_video'] and self.download_videos is Tristate.always:
self.download_pic(filename=filename,
url=edge['node']['video_url'],
mtime=post.date,
filename_suffix=str(edge_number))
downloaded = downloaded and edge_downloaded
edge_number += 1
elif post.typename in ['GraphImage', 'GraphVideo']: