How to use the command `instaloader` (with examples)
- Linux
- December 25, 2023
Instaloader is a command-line tool that allows you to download pictures, videos, captions, and other metadata from Instagram. It provides a wide range of options to tailor your downloads according to your requirements. By using instaloader
, you can download profiles, highlights, posts with geotags, stories, IGTV videos, and more from Instagram.
Use case 1: Download a profile
Code:
instaloader profile_name
Motivation: You can use this example to download all the posts from a specific Instagram profile. This is useful if you want to save someone’s posts for offline viewing or keep a backup of their content.
Explanation:
instaloader
is the command-line tool that initiates the download.profile_name
is the name of the Instagram profile that you want to download. Replace it with the actual Instagram username.
Example output:
The tool will fetch and download all the posts from the profile_name
Instagram profile. It will create a new folder with the profile name and save all the media files inside it.
Use case 2: Download highlights
Code:
instaloader --highlights profile_name
Motivation: Using this example, you can specifically download the highlights of an Instagram profile. Highlights are the stories that an Instagram user chooses to make permanent on their profile.
Explanation:
--highlights
is an option that instructsinstaloader
to download the highlights of the specified Instagram profile.profile_name
is the name of the Instagram profile from which you want to download highlights. Replace it with the actual Instagram username.
Example output:
The command will fetch and download all the highlights of the profile_name
Instagram profile. It will create a new folder with the profile name and save the highlights inside it.
Use case 3: Download posts with geotags (if available), suppressing any user interaction
Code:
instaloader --quiet --geotags profile_name
Motivation: This example allows you to download posts from an Instagram profile that have geotags attached to them. Geotags provide information about the location where the post was made.
Explanation:
--quiet
is an option that makesinstaloader
operate silently, without any output or interaction.--geotags
is an option that instructsinstaloader
to download posts with geotags.profile_name
is the name of the Instagram profile from which you want to download posts with geotags. Replace it with the actual Instagram username.
Example output:
The command will fetch and download all the posts from the profile_name
Instagram profile that have geotags. It will create a new folder with the profile name and save the media files with relevant metadata.
Use case 4: Specify a user agent for HTTP requests
Code:
instaloader --user-agent user_agent profile_name
Motivation: Using this example, you can specify a custom user agent for the HTTP requests made by instaloader
. This can be useful when you want to emulate a specific user agent to bypass access restrictions or simulate different devices.
Explanation:
--user-agent
is an option that allows you to provide a custom user agent for the HTTP requests made byinstaloader
.user_agent
is the user agent string that you want to use. Replace it with the desired user agent details.profile_name
is the name of the Instagram profile from which you want to download. Replace it with the actual Instagram username.
Example output:
The command will use the specified user_agent
for HTTP requests made by instaloader
while downloading the profile. It will fetch and download all the media and metadata from the profile_name
Instagram profile.
Use case 5: Specify login info and download posts (useful for private profiles)
Code:
instaloader --login username --password password profile_name
Motivation: This example allows you to download posts from a private Instagram profile. By providing your Instagram login credentials, you gain access to private profiles that you follow.
Explanation:
--login username
is an option that lets you specify the Instagram username for login.--password password
is an option that allows you to provide the Instagram password for login.profile_name
is the name of the Instagram profile from which you want to download posts. Replace it with the actual Instagram username.
Example output:
The command will log in to Instagram using the provided username
and password
, then fetch and download all the posts from the private profile_name
Instagram profile.
Use case 6: Skip a target if the first downloaded file has been found (useful for updating Instagram archives)
Code:
instaloader --fast-update profile_name
Motivation: This example is useful when you want to update your locally saved Instagram archives regularly. By skipping already downloaded files, you ensure that only new content is fetched and saved.
Explanation:
--fast-update
is an option that tellsinstaloader
to skip a target if the first downloaded file has already been found.profile_name
is the name of the Instagram profile for which you want to perform a fast update. Replace it with the actual Instagram username.
Example output:
The command will check if the first downloaded file from the profile_name
Instagram profile is found locally. If it exists, instaloader
will skip fetching posts that have already been saved.
Use case 7: Download stories and IGTV videos (login required)
Code:
instaloader --login username --password password --stories --igtv profile_name
Motivation: Using this example, you can download not only regular posts but also stories and IGTV videos from an Instagram profile. By providing your login credentials, you gain access to private stories and IGTV videos.
Explanation:
--stories
is an option that enables the download of stories (including highlights) from the Instagram profile.--igtv
is an option that allows you to download IGTV videos from the Instagram profile.--login username
is an option that lets you specify the Instagram username for login.--password password
is an option that allows you to provide the Instagram password for login.profile_name
is the name of the Instagram profile from which you want to download stories and IGTV videos. Replace it with the actual Instagram username.
Example output:
The command will log in to Instagram using the provided username
and password
, then fetch and download stories and IGTV videos from the profile_name
Instagram profile. The media files will be saved along with the regular posts.
Use case 8: Download all types of posts (login required)
Code:
instaloader --login username --password password --stories --igtv --highlights profile_name
Motivation: Using this example, you can download all types of posts, including regular posts, stories, IGTV videos, and highlights from an Instagram profile. Providing the login credentials is necessary to access these different types of content.
Explanation:
--stories
is an option that enables the download of stories (including highlights) from the Instagram profile.--igtv
is an option that allows you to download IGTV videos from the Instagram profile.--highlights
is an option that instructsinstaloader
to download the highlights of the specified Instagram profile.--login username
is an option that lets you specify the Instagram username for login.--password password
is an option that allows you to provide the Instagram password for login.profile_name
is the name of the Instagram profile from which you want to download all types of posts. Replace it with the actual Instagram username.
Example output:
The command will log in to Instagram using the provided username
and password
, then fetch and download regular posts, stories and IGTV videos, and highlights from the profile_name
Instagram profile. All the media files will be saved in their respective categories.