Do not call get_sidecar_nodes() if not needed
Do not call Post.get_sidecar_nodes() in download_post() if both --no-pictures and --no-videos are set.
This commit is contained in:
@@ -514,15 +514,16 @@ class Instaloader:
|
|||||||
# Download the image(s) / video thumbnail and videos within sidecars if desired
|
# Download the image(s) / video thumbnail and videos within sidecars if desired
|
||||||
downloaded = True
|
downloaded = True
|
||||||
if post.typename == 'GraphSidecar':
|
if post.typename == 'GraphSidecar':
|
||||||
for edge_number, sidecar_node in enumerate(post.get_sidecar_nodes(), start=1):
|
if self.download_pictures or self.download_videos:
|
||||||
if self.download_pictures and (not sidecar_node.is_video or self.download_video_thumbnails):
|
for edge_number, sidecar_node in enumerate(post.get_sidecar_nodes(), start=1):
|
||||||
# Download sidecar picture or video thumbnail (--no-pictures implies --no-video-thumbnails)
|
if self.download_pictures and (not sidecar_node.is_video or self.download_video_thumbnails):
|
||||||
downloaded &= self.download_pic(filename=filename, url=sidecar_node.display_url,
|
# Download sidecar picture or video thumbnail (--no-pictures implies --no-video-thumbnails)
|
||||||
mtime=post.date_local, filename_suffix=str(edge_number))
|
downloaded &= self.download_pic(filename=filename, url=sidecar_node.display_url,
|
||||||
if sidecar_node.is_video and self.download_videos:
|
mtime=post.date_local, filename_suffix=str(edge_number))
|
||||||
# Download sidecar video if desired
|
if sidecar_node.is_video and self.download_videos:
|
||||||
downloaded &= self.download_pic(filename=filename, url=sidecar_node.video_url,
|
# Download sidecar video if desired
|
||||||
mtime=post.date_local, filename_suffix=str(edge_number))
|
downloaded &= self.download_pic(filename=filename, url=sidecar_node.video_url,
|
||||||
|
mtime=post.date_local, filename_suffix=str(edge_number))
|
||||||
elif post.typename == 'GraphImage':
|
elif post.typename == 'GraphImage':
|
||||||
# Download picture
|
# Download picture
|
||||||
if self.download_pictures:
|
if self.download_pictures:
|
||||||
|
Reference in New Issue
Block a user