Command Line Options

Instaloader is invoked with:

$ instaloader [options] target [target ...]

where target is a profile, a "#hashtag", @profile (all profiles that profile is following), %location ID, or if logged in :feed (pictures from your feed), :stories (stories of your followees) or :saved (collection of posts marked as saved).

Here we explain the additional options that can be given to Instaloader to customize its behavior. For an introduction on how to use Instaloader, see Download Pictures from Instagram.

To get a list of all flags, their abbreviations and their descriptions, you may also run:

instaloader --help

Targets

Specify a list of targets. For each of these, Instaloader creates a folder and stores all posts along with the pictures’s captions there.

Instaloader supports the following targets:

  • profile

    Public profile, or private profile with --login.

    If an already-downloaded profile has been renamed, Instaloader automatically finds it by its unique ID and renames the folder accordingly.

    Besides the profile’s posts, its current profile picture is downloaded. For each profile you download,

    • --stories

      instructs Instaloader to also download the user’s stories,

    • --highlights

      to download highlights of each profile that is downloaded, and

    • --tagged

      to download posts where the user is tagged.

  • "#hashtag"

    Posts with a certain hashtag (the quotes are usually necessary),

  • %location id

    Posts tagged with a given location; the location ID is the numerical ID Instagram labels a location with (e.g. https://www.instagram.com/explore/locations/362629379/plymouth-naval-memorial/). Requires --login.

    New in version 4.2.

  • :stories

    The currently-visible stories of your followees (requires --login),

  • :feed

    Your feed (requires --login),

  • :saved

    Posts which are marked as saved (requires --login),

  • @profile

    All profiles that are followed by profile, i.e. the followees of profile (requires --login).

  • -post

    The single post with the given shortcode. Must be preceeded by -- in the argument list to not be mistaken as an option flag.

    New in version 4.1.

  • filename.json[.xz]

    Re-Download the given object

  • +args.txt

    Read targets (and options) from given textfile. See +args.txt.

What to Download of each Post

--no-pictures

Do not download post pictures. Cannot be used together with --fast-update. Implies --no-video-thumbnails, does not imply --no-videos.

New in version 4.1.

--no-videos, -V

Do not download videos.

--no-video-thumbnails

Do not download thumbnails of videos.

--geotags, -G

Download geotags when available. Geotags are stored as a text file with the location’s name and a Google Maps link. This requires an additional request to the Instagram server for each picture. Requires --login.

--comments, -C

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 default.

--no-captions

Do not create txt files.

--post-metadata-txt

Template to write in txt file for each Post. See Metadata Text Files.

--storyitem-metadata-txt

Template to write in txt file for each StoryItem. See Metadata Text Files.

--no-metadata-json

Do not create a JSON file containing the metadata of each post.

--no-compress-json

Do not xz compress JSON files, rather create pretty formatted JSONs.

What to Download of each Profile

--profile-pic-only, -P

Deprecated since version 4.1: Use --no-posts.

Only download profile picture.

--no-posts

Do not download regular posts.

New in version 4.1.

--no-profile-pic

Do not download profile picture.

--stories, -s

Also download stories of each profile that is downloaded. Requires --login.

--highlights

Also download highlights of each profile that is downloaded. Requires --login.

New in version 4.1.

--tagged

Also download posts where each profile is tagged.

New in version 4.1.

--stories-only

Deprecated since version 4.1: Use --stories --no-posts.

Rather than downloading regular posts of each specified profile, only download stories. Requires --login. Does not imply --no-profile-pic.

Note

If possible, use :stories target rather than --stories-only with all your followees. :stories uses fewer API requests.

Which Posts to Download

--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.

--post-filter filter, --only-if filter

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 instaloader.Post attributes. Example: --post-filter=viewer_has_liked. See Filter Posts for more examples.

--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 instaloader.StoryItem attributes. See Filter Posts for more examples.

--count COUNT, -c

Do not attempt to download more than COUNT posts. Applies only to #hashtag, %location id, and :feed.

Login (Download Private Profiles)

Instaloader can login to Instagram. This allows downloading private profiles. To login, pass the --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.

--login YOUR-USERNAME, -l YOUR-USERNAME

Login name (profile name) for your Instagram account.

--sessionfile SESSIONFILE, -f SESSIONFILE

Path for loading and storing session key file. Defaults to a path within your temporary directory, encoding your local username and your Instagram profile name.

--password YOUR-PASSWORD, -p YOUR-PASSWORD

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.

Warning

Using --password option is discouraged for security reasons. Enter your password interactively when asked, or use the sessionfile feature (--sessionfile to customize path).

How to Download

--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 Filename Specification.

--filename-pattern FILENAME_PATTERN

Prefix of filenames, relative to the directory given with --dirname-pattern. {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 {date_utc}_UTC. See Filename Specification for a list of supported tokens.

--user-agent USER_AGENT

User Agent to use for HTTP requests. Per default, Instaloader pretends being Chrome/51.

--max-connection-attempts N

Maximum number of connection attempts until a request is aborted. Defaults to 3. If a connection fails, it can be manually skipped by hitting Control-c. Set this to 0 to retry infinitely.

--commit-mode

Tries to ensure downloaded images avoid corruption in case of unexpected interruption. If the last picture is corrupted, Instaloader will fix the picture the next time it is run.

New in version 4.2.

Miscellaneous Options

--quiet, -q

Disable user interaction, i.e. do not print messages (except errors) and fail if login credentials are needed but not given. This is handy for running Instaloader as Cronjob.

+args.txt

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 info from CLI, and can also be used to simplify managment of long arguments.

Note

Text file should separate arguments with line breaks.

args.txt example:

--login=MYUSERNAME
--password=MYPASSWORD
--fast-update
profile1
profile2

New in version 4.1.

Next Section

Python Module instaloader

Table of Contents