parent
5f57345f1b
commit
06b7edd6d5
@ -35,6 +35,12 @@ automatically **finds it by its unique ID** and renames the folder likewise.
|
|||||||
|
|
||||||
Do not download profile picture.
|
Do not download profile picture.
|
||||||
|
|
||||||
|
.. option:: --no-pictures
|
||||||
|
|
||||||
|
Do not download post pictures. Cannot be used together with
|
||||||
|
:option:`--fast-update`. Implies :option:`--no-video-thumbnails`, does not
|
||||||
|
imply :option:`--no-videos`.
|
||||||
|
|
||||||
.. option:: --no-videos, -V
|
.. option:: --no-videos, -V
|
||||||
|
|
||||||
Do not download videos.
|
Do not download videos.
|
||||||
|
@ -230,6 +230,9 @@ def main():
|
|||||||
help='Only download profile picture.')
|
help='Only download profile picture.')
|
||||||
g_what.add_argument('--no-profile-pic', action='store_true',
|
g_what.add_argument('--no-profile-pic', action='store_true',
|
||||||
help='Do not download profile picture.')
|
help='Do not download profile picture.')
|
||||||
|
g_what.add_argument('--no-pictures', action='store_true',
|
||||||
|
help='Do not download post pictures. Cannot be used together with --fast-update. '
|
||||||
|
'Implies --no-video-thumbnails, does not imply --no-videos.')
|
||||||
g_what.add_argument('-V', '--no-videos', action='store_true',
|
g_what.add_argument('-V', '--no-videos', action='store_true',
|
||||||
help='Do not download videos.')
|
help='Do not download videos.')
|
||||||
g_what.add_argument('--no-video-thumbnails', action='store_true',
|
g_what.add_argument('--no-video-thumbnails', action='store_true',
|
||||||
@ -349,8 +352,12 @@ def main():
|
|||||||
raise SystemExit("--no-captions and --post-metadata-txt or --storyitem-metadata-txt given; "
|
raise SystemExit("--no-captions and --post-metadata-txt or --storyitem-metadata-txt given; "
|
||||||
"That contradicts.")
|
"That contradicts.")
|
||||||
|
|
||||||
|
if args.no_pictures and args.fast_update:
|
||||||
|
raise SystemExit('--no-pictures and --fast-update cannot be used together.')
|
||||||
|
|
||||||
loader = Instaloader(sleep=not args.no_sleep, quiet=args.quiet, user_agent=args.user_agent,
|
loader = Instaloader(sleep=not args.no_sleep, quiet=args.quiet, user_agent=args.user_agent,
|
||||||
dirname_pattern=args.dirname_pattern, filename_pattern=args.filename_pattern,
|
dirname_pattern=args.dirname_pattern, filename_pattern=args.filename_pattern,
|
||||||
|
download_pictures=not args.no_pictures,
|
||||||
download_videos=not args.no_videos, download_video_thumbnails=not args.no_video_thumbnails,
|
download_videos=not args.no_videos, download_video_thumbnails=not args.no_video_thumbnails,
|
||||||
download_geotags=args.geotags,
|
download_geotags=args.geotags,
|
||||||
download_comments=args.comments, save_metadata=not args.no_metadata_json,
|
download_comments=args.comments, save_metadata=not args.no_metadata_json,
|
||||||
|
@ -80,6 +80,7 @@ class Instaloader:
|
|||||||
:param user_agent: :option:`--user-agent`
|
:param user_agent: :option:`--user-agent`
|
||||||
:param dirname_pattern: :option:`--dirname-pattern`, default is ``{target}``
|
:param dirname_pattern: :option:`--dirname-pattern`, default is ``{target}``
|
||||||
:param filename_pattern: :option:`--filename-pattern`, default is ``{date_utc}_UTC``
|
:param filename_pattern: :option:`--filename-pattern`, default is ``{date_utc}_UTC``
|
||||||
|
:param download_pictures: not :option:`--no-pictures`
|
||||||
:param download_videos: not :option:`--no-videos`
|
:param download_videos: not :option:`--no-videos`
|
||||||
:param download_video_thumbnails: not :option:`--no-video-thumbnails`
|
:param download_video_thumbnails: not :option:`--no-video-thumbnails`
|
||||||
:param download_geotags: :option:`--geotags`
|
:param download_geotags: :option:`--geotags`
|
||||||
@ -102,6 +103,7 @@ class Instaloader:
|
|||||||
user_agent: Optional[str] = None,
|
user_agent: Optional[str] = None,
|
||||||
dirname_pattern: Optional[str] = None,
|
dirname_pattern: Optional[str] = None,
|
||||||
filename_pattern: Optional[str] = None,
|
filename_pattern: Optional[str] = None,
|
||||||
|
download_pictures=True,
|
||||||
download_videos: bool = True,
|
download_videos: bool = True,
|
||||||
download_video_thumbnails: bool = True,
|
download_video_thumbnails: bool = True,
|
||||||
download_geotags: bool = True,
|
download_geotags: bool = True,
|
||||||
@ -118,6 +120,7 @@ class Instaloader:
|
|||||||
# configuration parameters
|
# configuration parameters
|
||||||
self.dirname_pattern = dirname_pattern or "{target}"
|
self.dirname_pattern = dirname_pattern or "{target}"
|
||||||
self.filename_pattern = filename_pattern or "{date_utc}_UTC"
|
self.filename_pattern = filename_pattern or "{date_utc}_UTC"
|
||||||
|
self.download_pictures = download_pictures
|
||||||
self.download_videos = download_videos
|
self.download_videos = download_videos
|
||||||
self.download_video_thumbnails = download_video_thumbnails
|
self.download_video_thumbnails = download_video_thumbnails
|
||||||
self.download_geotags = download_geotags
|
self.download_geotags = download_geotags
|
||||||
@ -133,11 +136,15 @@ class Instaloader:
|
|||||||
def anonymous_copy(self):
|
def anonymous_copy(self):
|
||||||
"""Yield an anonymous, otherwise equally-configured copy of an Instaloader instance; Then copy its error log."""
|
"""Yield an anonymous, otherwise equally-configured copy of an Instaloader instance; Then copy its error log."""
|
||||||
new_loader = Instaloader(self.context.sleep, self.context.quiet, self.context.user_agent, self.dirname_pattern,
|
new_loader = Instaloader(self.context.sleep, self.context.quiet, self.context.user_agent, self.dirname_pattern,
|
||||||
self.filename_pattern, self.download_videos, self.download_video_thumbnails,
|
self.filename_pattern, download_pictures=self.download_pictures,
|
||||||
self.download_geotags, self.download_comments, self.save_metadata,
|
download_videos=self.download_videos,
|
||||||
self.compress_json, self.post_metadata_txt_pattern,
|
download_video_thumbnails=self.download_video_thumbnails,
|
||||||
self.storyitem_metadata_txt_pattern, self.context.graphql_count_per_slidingwindow,
|
download_geotags=self.download_geotags, download_comments=self.download_comments,
|
||||||
self.context.max_connection_attempts)
|
save_metadata=self.save_metadata, compress_json=self.compress_json,
|
||||||
|
post_metadata_txt_pattern=self.post_metadata_txt_pattern,
|
||||||
|
storyitem_metadata_txt_pattern=self.storyitem_metadata_txt_pattern,
|
||||||
|
graphql_rate_limit=self.context.graphql_count_per_slidingwindow,
|
||||||
|
max_connection_attempts=self.context.max_connection_attempts)
|
||||||
new_loader.context.query_timestamps = self.context.query_timestamps
|
new_loader.context.query_timestamps = self.context.query_timestamps
|
||||||
yield new_loader
|
yield new_loader
|
||||||
self.context.error_log.extend(new_loader.context.error_log)
|
self.context.error_log.extend(new_loader.context.error_log)
|
||||||
@ -343,25 +350,26 @@ 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 = False
|
downloaded = False
|
||||||
if post.typename == 'GraphSidecar':
|
if self.download_pictures:
|
||||||
edge_number = 1
|
if post.typename == 'GraphSidecar':
|
||||||
for sidecar_node in post.get_sidecar_nodes():
|
edge_number = 1
|
||||||
# Download picture or video thumbnail
|
for sidecar_node in post.get_sidecar_nodes():
|
||||||
if not sidecar_node.is_video or self.download_video_thumbnails is True:
|
# Download picture or video thumbnail
|
||||||
downloaded |= self.download_pic(filename=filename, url=sidecar_node.display_url,
|
if not sidecar_node.is_video or self.download_video_thumbnails is True:
|
||||||
mtime=post.date_local, filename_suffix=str(edge_number))
|
downloaded |= self.download_pic(filename=filename, url=sidecar_node.display_url,
|
||||||
# Additionally download video if available and desired
|
mtime=post.date_local, filename_suffix=str(edge_number))
|
||||||
if sidecar_node.is_video and self.download_videos is True:
|
# Additionally download video if available and desired
|
||||||
downloaded |= self.download_pic(filename=filename, url=sidecar_node.video_url,
|
if sidecar_node.is_video and self.download_videos is True:
|
||||||
mtime=post.date_local, filename_suffix=str(edge_number))
|
downloaded |= self.download_pic(filename=filename, url=sidecar_node.video_url,
|
||||||
edge_number += 1
|
mtime=post.date_local, filename_suffix=str(edge_number))
|
||||||
elif post.typename == 'GraphImage':
|
edge_number += 1
|
||||||
downloaded = self.download_pic(filename=filename, url=post.url, mtime=post.date_local)
|
elif post.typename == 'GraphImage':
|
||||||
elif post.typename == 'GraphVideo':
|
|
||||||
if self.download_video_thumbnails is True:
|
|
||||||
downloaded = self.download_pic(filename=filename, url=post.url, mtime=post.date_local)
|
downloaded = self.download_pic(filename=filename, url=post.url, mtime=post.date_local)
|
||||||
else:
|
elif post.typename == 'GraphVideo':
|
||||||
self.context.error("Warning: {0} has unknown typename: {1}".format(post, post.typename))
|
if self.download_video_thumbnails is True:
|
||||||
|
downloaded = self.download_pic(filename=filename, url=post.url, mtime=post.date_local)
|
||||||
|
else:
|
||||||
|
self.context.error("Warning: {0} has unknown typename: {1}".format(post, post.typename))
|
||||||
|
|
||||||
# Save caption if desired
|
# Save caption if desired
|
||||||
metadata_string = _ArbitraryItemFormatter(post).format(self.post_metadata_txt_pattern).strip()
|
metadata_string = _ArbitraryItemFormatter(post).format(self.post_metadata_txt_pattern).strip()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user