2018-04-30 09:56:43 +02:00
|
|
|
.. _command-line-options:
|
|
|
|
|
2017-08-25 16:54:36 +02:00
|
|
|
Command Line Options
|
|
|
|
====================
|
|
|
|
|
2017-11-14 11:18:30 +01:00
|
|
|
Instaloader is invoked with::
|
2017-09-08 10:35:38 +02:00
|
|
|
|
2017-11-14 11:18:30 +01:00
|
|
|
$ instaloader [options] target [target ...]
|
|
|
|
|
|
|
|
where ``target`` is a ``profile``, a ``"#hashtag"``, ``@profile`` (all profiles
|
2018-12-17 21:35:31 +01:00
|
|
|
that *profile* is following), ``%location ID``, or if logged in ``:feed`` (pictures from your
|
2018-03-13 13:53:21 +01:00
|
|
|
feed), ``:stories`` (stories of your followees) or ``:saved`` (collection of
|
|
|
|
posts marked as saved).
|
2017-11-14 11:18:30 +01:00
|
|
|
|
|
|
|
Here we explain the additional options that can be given to Instaloader to
|
2018-08-20 12:32:57 +02:00
|
|
|
customize its behavior. For an
|
2018-04-30 09:56:43 +02:00
|
|
|
introduction on how to use Instaloader, see
|
|
|
|
:ref:`download-pictures-from-instagram`.
|
2017-09-08 10:35:38 +02:00
|
|
|
|
2018-08-20 12:32:57 +02:00
|
|
|
To get a list of all flags, their abbreviations and
|
|
|
|
their descriptions, you may also run::
|
2017-09-08 10:35:38 +02:00
|
|
|
|
2018-08-20 12:32:57 +02:00
|
|
|
instaloader --help
|
2017-09-08 10:35:38 +02:00
|
|
|
|
2018-08-20 12:32:57 +02:00
|
|
|
Targets
|
|
|
|
^^^^^^^
|
2017-09-08 10:35:38 +02:00
|
|
|
|
2018-08-20 12:32:57 +02:00
|
|
|
Specify a list of targets. For each of these, Instaloader creates a folder and
|
2024-03-29 10:20:13 +01:00
|
|
|
stores all posts along with the pictures' captions there.
|
2017-09-08 10:35:38 +02:00
|
|
|
|
2018-08-20 12:32:57 +02:00
|
|
|
.. include:: basic-usage.rst
|
|
|
|
:start-after: targets-start
|
|
|
|
:end-before: targets-end
|
2017-12-14 15:46:42 +01:00
|
|
|
|
2018-08-20 12:32:57 +02:00
|
|
|
- ``filename.json[.xz]``
|
|
|
|
Re-Download the given object
|
|
|
|
|
|
|
|
- ``+args.txt``
|
2020-07-30 16:41:45 +02:00
|
|
|
Read targets (and options) from given text file. See :option:`+args.txt`.
|
2018-08-20 12:32:57 +02:00
|
|
|
|
|
|
|
What to Download of each Post
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2017-12-14 15:46:42 +01:00
|
|
|
|
2018-08-20 10:37:51 +02:00
|
|
|
.. 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`.
|
|
|
|
|
2018-08-23 17:25:28 +02:00
|
|
|
.. versionadded:: 4.1
|
|
|
|
|
2018-04-29 16:41:24 +02:00
|
|
|
.. option:: --no-videos, -V
|
2017-09-08 10:35:38 +02:00
|
|
|
|
|
|
|
Do not download videos.
|
|
|
|
|
2017-12-14 16:46:19 +01:00
|
|
|
.. option:: --no-video-thumbnails
|
|
|
|
|
|
|
|
Do not download thumbnails of videos.
|
|
|
|
|
2018-04-29 16:41:24 +02:00
|
|
|
.. option:: --geotags, -G
|
2017-09-08 10:35:38 +02:00
|
|
|
|
2020-07-31 22:12:27 +02:00
|
|
|
Download geotags when available. Geotags are stored as a text file with
|
2017-09-08 10:35:38 +02:00
|
|
|
the location's name and a Google Maps link. This requires an additional
|
2024-05-18 16:13:44 +02:00
|
|
|
request to the Instagram server for each picture. Requires :ref:`login<login>`.
|
2017-09-08 10:35:38 +02:00
|
|
|
|
2018-04-29 16:41:24 +02:00
|
|
|
.. option:: --comments, -C
|
2017-09-08 10:35:38 +02:00
|
|
|
|
|
|
|
Download and update comments for each post. This requires an additional
|
|
|
|
request to the Instagram server for each post, which is why it is disabled by
|
2024-05-18 16:13:44 +02:00
|
|
|
default. Requires :ref:`login<login>`.
|
2017-09-08 10:35:38 +02:00
|
|
|
|
|
|
|
.. option:: --no-captions
|
|
|
|
|
2018-04-13 22:54:40 +02:00
|
|
|
Do not create txt files.
|
|
|
|
|
|
|
|
.. option:: --post-metadata-txt
|
|
|
|
|
2018-04-29 16:24:55 +02:00
|
|
|
Template to write in txt file for each Post. See :ref:`metadata-text-files`.
|
2018-04-13 22:54:40 +02:00
|
|
|
|
|
|
|
.. option:: --storyitem-metadata-txt
|
|
|
|
|
2018-04-29 16:24:55 +02:00
|
|
|
Template to write in txt file for each StoryItem. See
|
|
|
|
:ref:`metadata-text-files`.
|
2017-09-08 10:35:38 +02:00
|
|
|
|
2020-12-14 22:11:33 +01:00
|
|
|
.. option:: --slide
|
|
|
|
|
|
|
|
Download only selected images of a sidecar. You can select single images using their
|
|
|
|
index in the sidecar starting with the leftmost or you can specify a range of images
|
|
|
|
with the following syntax: ``start_index-end_index``. Example:
|
|
|
|
``--slide 1`` will select only the first image, ``--slide last`` only the last one and ``--slide 1-3`` will select only
|
|
|
|
the first three images.
|
|
|
|
|
|
|
|
.. versionadded:: 4.6
|
|
|
|
|
2018-08-20 12:32:57 +02:00
|
|
|
.. option:: --no-metadata-json
|
|
|
|
|
|
|
|
Do not create a JSON file containing the metadata of each post.
|
|
|
|
|
|
|
|
.. option:: --no-compress-json
|
|
|
|
|
|
|
|
Do not xz compress JSON files, rather create pretty formatted JSONs.
|
|
|
|
|
|
|
|
What to Download of each Profile
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2018-08-20 15:23:11 +02:00
|
|
|
.. option:: --no-posts
|
|
|
|
|
|
|
|
Do not download regular posts.
|
|
|
|
|
2018-08-24 11:38:45 +02:00
|
|
|
.. versionadded:: 4.1
|
|
|
|
|
2018-08-20 12:32:57 +02:00
|
|
|
.. option:: --no-profile-pic
|
|
|
|
|
|
|
|
Do not download profile picture.
|
|
|
|
|
2018-04-29 16:41:24 +02:00
|
|
|
.. option:: --stories, -s
|
2017-09-08 10:35:38 +02:00
|
|
|
|
2020-07-31 22:12:27 +02:00
|
|
|
Also download stories of each profile that is downloaded. Requires
|
2024-05-18 16:13:44 +02:00
|
|
|
:ref:`login<login>`.
|
2017-09-08 10:35:38 +02:00
|
|
|
|
2018-08-24 00:23:19 +02:00
|
|
|
.. option:: --highlights
|
|
|
|
|
2020-07-31 22:12:27 +02:00
|
|
|
Also download highlights of each profile that is downloaded. Requires
|
2024-05-18 16:13:44 +02:00
|
|
|
:ref:`login<login>`.
|
2018-08-24 00:23:19 +02:00
|
|
|
|
|
|
|
.. versionadded:: 4.1
|
|
|
|
|
2018-08-20 10:44:20 +02:00
|
|
|
.. option:: --tagged
|
|
|
|
|
|
|
|
Also download posts where each profile is tagged.
|
|
|
|
|
2018-08-23 17:25:28 +02:00
|
|
|
.. versionadded:: 4.1
|
|
|
|
|
2024-10-02 08:03:53 +02:00
|
|
|
.. option:: --reels
|
|
|
|
|
|
|
|
Also download Reels videos.
|
|
|
|
|
|
|
|
.. versionadded:: 4.14
|
|
|
|
|
2020-03-14 16:56:51 +01:00
|
|
|
.. option:: --igtv
|
|
|
|
|
|
|
|
Also download IGTV videos.
|
|
|
|
|
|
|
|
.. versionadded:: 4.3
|
|
|
|
|
2018-08-20 12:32:57 +02:00
|
|
|
Which Posts to Download
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
.. option:: --fast-update, -F
|
|
|
|
|
|
|
|
For each target, stop when encountering the first already-downloaded picture.
|
|
|
|
This flag is recommended when you use Instaloader to update your personal
|
|
|
|
Instagram archive.
|
|
|
|
|
2021-05-27 18:22:33 +02:00
|
|
|
.. option:: --latest-stamps [STAMPSFILE]
|
|
|
|
|
|
|
|
Works similarly to :option:`--fast-update`, but instead of relying on already
|
|
|
|
downloaded media, the time each profile was downloaded is stored, and only
|
|
|
|
media newer than the last download is fetched. This allows updating your
|
|
|
|
personal Instagram archive while emptying the target directories.
|
|
|
|
|
|
|
|
Only works for media associated with a specific profile, and that is returned
|
|
|
|
in chronological order: profile posts, profile stories, profile IGTV posts
|
|
|
|
and profile tagged posts.
|
|
|
|
|
|
|
|
By default, the information is stored in
|
|
|
|
``~/.config/instaloader/latest-stamps.ini``, but you can specify an
|
|
|
|
alternative location.
|
|
|
|
|
|
|
|
.. versionadded:: 4.8
|
|
|
|
|
2018-04-19 15:12:05 +02:00
|
|
|
.. option:: --post-filter filter, --only-if filter
|
2017-09-08 10:35:38 +02:00
|
|
|
|
|
|
|
Expression that, if given, must evaluate to True for each post to be
|
|
|
|
downloaded. Must be a syntactically valid Python expression. Variables are
|
|
|
|
evaluated to :class:`instaloader.Post` attributes. Example:
|
2018-04-19 15:12:05 +02:00
|
|
|
``--post-filter=viewer_has_liked``. See :ref:`filter-posts` for more
|
2017-09-08 10:35:38 +02:00
|
|
|
examples.
|
|
|
|
|
2018-04-19 15:12:05 +02:00
|
|
|
.. option:: --storyitem-filter filter
|
|
|
|
|
|
|
|
Expression that, if given, must evaluate to True for each storyitem to be
|
|
|
|
downloaded. Must be a syntactically valid Python expression. Variables are
|
|
|
|
evaluated to :class:`instaloader.StoryItem` attributes.
|
|
|
|
See :ref:`filter-posts` for more examples.
|
|
|
|
|
2018-04-29 16:41:24 +02:00
|
|
|
.. option:: --count COUNT, -c
|
2017-09-08 10:35:38 +02:00
|
|
|
|
2021-05-17 18:51:39 +02:00
|
|
|
Do not attempt to download more than COUNT posts. Applies to
|
|
|
|
``#hashtag``, ``%location_id``, ``:feed``, and ``:saved``.
|
2017-09-08 10:35:38 +02:00
|
|
|
|
2024-05-18 16:13:44 +02:00
|
|
|
.. _login:
|
2017-09-08 10:35:38 +02:00
|
|
|
|
|
|
|
Login (Download Private Profiles)
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2020-07-31 22:12:27 +02:00
|
|
|
Instaloader can login to Instagram. This allows downloading private
|
2017-09-08 10:35:38 +02:00
|
|
|
profiles. To login, pass the :option:`--login` option. Your session cookie (not your
|
|
|
|
password!) will be saved to a local file to be reused next time you want
|
|
|
|
Instaloader to login.
|
|
|
|
|
2024-05-18 16:13:44 +02:00
|
|
|
Instead of :option:`--login`, it is possible to use
|
|
|
|
:option:`--load-cookies` to import a session from a browser.
|
|
|
|
|
2018-04-29 16:41:24 +02:00
|
|
|
.. option:: --login YOUR-USERNAME, -l YOUR-USERNAME
|
2017-09-08 10:35:38 +02:00
|
|
|
|
|
|
|
Login name (profile name) for your Instagram account.
|
|
|
|
|
2023-11-15 07:32:18 +01:00
|
|
|
.. option:: --load-cookies BROWSER-NAME, -b BROWSER-NAME
|
|
|
|
|
2023-12-18 07:50:45 +01:00
|
|
|
Use Instagram cookie in your browser to login.
|
|
|
|
This feature requires the browser_cookie3 library.
|
|
|
|
Compatible with :option:`--cookiefile` if you want to load cookies from browser profiles.
|
|
|
|
Incompatible with :option:`--login` due to potential username mismatch between user input and browser login.
|
2024-05-18 16:11:12 +02:00
|
|
|
Supported browsers: Brave, Chrome, Chromium, Edge, Firefox, LibreWolf, Opera, Opera_GX, Safari and Vivaldi.
|
2023-12-18 07:50:45 +01:00
|
|
|
|
2024-05-18 16:13:44 +02:00
|
|
|
In subsequent runs, you can just use :option:`--login` to reuse the
|
|
|
|
same session, which is saved by Instaloader.
|
2023-12-18 07:50:45 +01:00
|
|
|
|
|
|
|
.. versionadded:: 4.11
|
2023-11-15 07:32:18 +01:00
|
|
|
|
|
|
|
.. option:: --cookiefile COOKIE-FILE, -B COOKIE-FILE
|
|
|
|
|
|
|
|
Cookie file path of a browser profile to load cookies from.
|
|
|
|
|
2023-12-18 07:58:53 +01:00
|
|
|
.. versionadded:: 4.11
|
|
|
|
|
2018-04-29 16:41:24 +02:00
|
|
|
.. option:: --sessionfile SESSIONFILE, -f SESSIONFILE
|
2017-09-08 10:35:38 +02:00
|
|
|
|
2020-06-06 10:49:41 +02:00
|
|
|
Path for loading and storing session key file. Defaults to
|
|
|
|
``~/.config/instaloader/session-YOUR-USERNAME``.
|
2017-09-08 10:35:38 +02:00
|
|
|
|
2018-04-29 16:41:24 +02:00
|
|
|
.. option:: --password YOUR-PASSWORD, -p YOUR-PASSWORD
|
2017-09-08 10:35:38 +02:00
|
|
|
|
|
|
|
Password for your Instagram account. Without this option, you'll be prompted
|
|
|
|
for your password interactively if there is not yet a valid session file.
|
|
|
|
|
2018-04-30 09:56:43 +02:00
|
|
|
.. warning:: Using :option:`--password` option is discouraged for security
|
|
|
|
reasons. Enter your password interactively when asked, or use the
|
|
|
|
sessionfile feature (:option:`--sessionfile` to customize path).
|
|
|
|
|
2017-09-08 10:35:38 +02:00
|
|
|
How to Download
|
|
|
|
^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
.. option:: --dirname-pattern DIRNAME_PATTERN
|
|
|
|
|
|
|
|
Name of directory where to store posts. ``{profile}`` is replaced by the
|
|
|
|
profile name, ``{target}`` is replaced by the target you specified, i.e.
|
|
|
|
either ``:feed``, ``#hashtag`` or the profile name. Defaults to ``{target}``.
|
|
|
|
See :ref:`filename-specification`.
|
|
|
|
|
|
|
|
.. option:: --filename-pattern FILENAME_PATTERN
|
|
|
|
|
2021-05-15 16:25:36 +02:00
|
|
|
Prefix of filenames for posts and stories, relative to the directory given with
|
2018-04-29 11:57:28 +02:00
|
|
|
:option:`--dirname-pattern`. ``{profile}`` is replaced by the profile name,
|
2017-09-08 10:35:38 +02:00
|
|
|
``{target}`` is replaced by the target you specified, i.e. either ``:feed``,
|
2018-04-29 11:57:28 +02:00
|
|
|
``#hashtag`` or the profile name. Defaults to ``{date_utc}_UTC``.
|
|
|
|
See :ref:`filename-specification` for a list of supported tokens.
|
2017-09-08 10:35:38 +02:00
|
|
|
|
2021-05-15 16:25:36 +02:00
|
|
|
.. option:: --title-pattern TITLE_PATTERN
|
|
|
|
|
|
|
|
Prefix of filenames for profile pics, hashtag profile pics, and highlight
|
|
|
|
covers, relative to the directory given with :option:`--dirname-pattern`.
|
|
|
|
Defaults to ``{date_utc}_UTC_{typename}`` if :option:`--dirname-pattern`
|
|
|
|
contains ``{target}`` or ``{profile}``, otherwise defaults to
|
|
|
|
``{target}_{date_utc}_UTC_{typename}``.
|
|
|
|
See :ref:`filename-specification` for a list of supported tokens.
|
|
|
|
|
|
|
|
.. versionadded:: 4.8
|
|
|
|
|
2022-03-17 15:27:36 +01:00
|
|
|
.. option:: --sanitize-paths
|
|
|
|
|
|
|
|
Force sanitization of paths so that the resulting file and directory names
|
|
|
|
are valid on both Windows and Unix.
|
|
|
|
|
|
|
|
.. versionadded:: 4.9
|
|
|
|
|
2020-07-21 17:28:55 +02:00
|
|
|
.. option:: --resume-prefix prefix
|
|
|
|
|
|
|
|
For many targets, Instaloader is capable of resuming a previously-aborted
|
|
|
|
download loop. To do so, it creates a JSON file within the target directory
|
|
|
|
when interrupted. This option controls the prefix for filenames that are
|
|
|
|
used to save the information to resume an interrupted download. The default
|
|
|
|
prefix is ``iterator``.
|
|
|
|
|
2021-02-24 16:01:22 +01:00
|
|
|
Resuming an interrupted download is supported for the following targets:
|
|
|
|
- Profile posts,
|
|
|
|
- Profile IGTV posts (:option:`--igtv`),
|
|
|
|
- Profile tagged posts (:option:`--tagged`),
|
2022-03-26 16:59:42 +01:00
|
|
|
- Saved posts (``:saved``),
|
|
|
|
- Hashtags.
|
2021-02-24 16:01:22 +01:00
|
|
|
|
|
|
|
This feature is enabled by default for targets where it is supported;
|
|
|
|
:option:`--resume-prefix` only changes the name of the iterator files.
|
|
|
|
|
|
|
|
To turn this feature off, use :option:`--no-resume`.
|
|
|
|
|
2020-07-21 17:28:55 +02:00
|
|
|
JSON files with resume information are always compressed, regardless of
|
|
|
|
:option:`--no-compress-json`.
|
|
|
|
|
|
|
|
.. versionadded:: 4.5
|
|
|
|
|
|
|
|
.. option:: --no-resume
|
|
|
|
|
|
|
|
Do not resume a previously-aborted download iteration, and do not save such
|
|
|
|
information when interrupted.
|
|
|
|
|
|
|
|
.. versionadded:: 4.5
|
|
|
|
|
2017-09-08 10:35:38 +02:00
|
|
|
.. option:: --user-agent USER_AGENT
|
|
|
|
|
|
|
|
User Agent to use for HTTP requests. Per default, Instaloader pretends being
|
2024-08-10 17:54:44 +02:00
|
|
|
Chrome/127 on Linux.
|
2017-09-08 10:35:38 +02:00
|
|
|
|
2017-09-29 16:09:15 +02:00
|
|
|
.. option:: --max-connection-attempts N
|
|
|
|
|
|
|
|
Maximum number of connection attempts until a request is aborted. Defaults
|
2017-10-30 18:38:03 +01:00
|
|
|
to ``3``. If a connection fails, it can be manually skipped by hitting
|
2017-09-29 16:09:15 +02:00
|
|
|
:kbd:`Control-c`. Set this to ``0`` to retry infinitely.
|
|
|
|
|
2020-02-17 19:05:39 +01:00
|
|
|
.. option:: --request-timeout N
|
|
|
|
|
2020-11-14 18:47:37 +01:00
|
|
|
Seconds to wait before timing out a connection request. Defaults to 300.
|
2020-02-17 19:05:39 +01:00
|
|
|
|
|
|
|
.. versionadded:: 4.3
|
|
|
|
|
2020-11-14 18:47:37 +01:00
|
|
|
.. versionchanged:: 4.6
|
|
|
|
Enabled this option by default with a timeout of 300 seconds.
|
|
|
|
|
2021-02-13 19:04:05 +01:00
|
|
|
.. option:: --abort-on STATUS_CODE_LIST
|
|
|
|
|
|
|
|
Comma-separated list of HTTP status codes that cause Instaloader to abort,
|
|
|
|
bypassing all retry logic.
|
|
|
|
|
|
|
|
For example, with ``--abort-on=302,400,429``, Instaloader will stop if a
|
|
|
|
request is responded with a 302 redirect, a Bad Request error, or a Too Many
|
|
|
|
Requests error.
|
|
|
|
|
|
|
|
.. versionadded:: 4.7
|
|
|
|
|
2021-04-22 20:06:35 +02:00
|
|
|
.. option:: --no-iphone
|
|
|
|
|
|
|
|
Do not attempt to download iPhone version of images and videos.
|
|
|
|
|
|
|
|
.. versionadded:: 4.8
|
|
|
|
|
2017-09-08 10:35:38 +02:00
|
|
|
Miscellaneous Options
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2018-04-29 16:41:24 +02:00
|
|
|
.. option:: --quiet, -q
|
2017-09-08 10:35:38 +02:00
|
|
|
|
|
|
|
Disable user interaction, i.e. do not print messages (except errors) and fail
|
2018-04-30 09:56:43 +02:00
|
|
|
if login credentials are needed but not given.
|
|
|
|
This is handy for running :ref:`instaloader-as-cronjob`.
|
2018-08-20 09:00:51 +02:00
|
|
|
|
|
|
|
.. option:: +args.txt
|
|
|
|
|
2019-01-03 17:05:43 +01:00
|
|
|
Read arguments from file `args.txt`, a shortcut to provide arguments from
|
|
|
|
file rather than command-line. This provides a convenient way to hide login
|
2020-07-30 16:41:45 +02:00
|
|
|
info from CLI, and can also be used to simplify management of long arguments.
|
2022-06-16 10:25:43 +02:00
|
|
|
You can provide more than one file at once, e.g.: ``+args1.txt +args2.txt``.
|
2018-08-20 09:00:51 +02:00
|
|
|
|
2018-08-23 17:25:28 +02:00
|
|
|
.. note::
|
2018-08-20 09:00:51 +02:00
|
|
|
|
2019-01-03 17:05:43 +01:00
|
|
|
Text file should separate arguments with line breaks.
|
2018-08-20 09:00:51 +02:00
|
|
|
|
2022-06-16 10:25:43 +02:00
|
|
|
`args.txt` example::
|
2018-08-20 09:00:51 +02:00
|
|
|
|
2020-07-31 22:12:27 +02:00
|
|
|
--login=MYUSERNAME
|
|
|
|
--password=MYPASSWORD
|
|
|
|
--fast-update
|
|
|
|
profile1
|
|
|
|
profile2
|
2018-08-20 09:00:51 +02:00
|
|
|
|
2018-08-23 17:25:28 +02:00
|
|
|
.. versionadded:: 4.1
|