Dec 07, 2021

Proctorzone

Contribute

Tools

Related Sites

More...

edit SideBar

Search

Downloading From Instagram Profiles

17 May, 2021, at 10:21 PM WIB by Hendrik in Uncategorized, Linux, Instagram (0 comments)

Suppose, we want to download instagram posts from a profile, along with its stories, highlights, and IGTVs to our computer. All we got is our computer, an instagram account, and an active internet connection. Doing it manually would be tedious, so we have to find a semi-automated approach. So, what should we do?

Instalooter

I came across this interesting piece of command-line tool, called InstaLooter. The usage itself is very easy, as described here. All I have to do is to first install PyPI. I installed pip3, and then I proceeded with git. Following the instruction, I did:

$ git clone https://github.com/althonos/InstaLooter
$ cd InstaLooter
# pip3 install .

Then, we can use the following command:

$ instaLooter user <username> [<directory>] [options]

I used the -v option to download videos as well, and afterwards, in the same target directory, we can download only the newest entries with -N option.

For downloading individual posts, we can use the following command:

$ instaLooter post <post_token> <directory> [options]

To login into your account, do the following:

$ instalooter login

Afterwards, you'd be prompted to include your credentials. The credentials would be stored in a cache file, and it would use that to interact with target profiles.

It is very handy.

So what I did was to make a bash script with the following content:

#!/bin/bash
instalooter user $1 "./$1" -v -N

Suppose the script name is igpost, then it would take the following terms:

$ ./igpost <target>

Where <target> is the target profile name. Then it would create a folder named <target> where all of the posts of that profile would be downloaded.

Unfortunately, it couldn't take instagram stories, highlights, and tagged posts.

For that, we would need instaloader.

Instaloader

Instaloader is a python tool to download from an instagram profile. The plus point of this tool compared to instalooter is that it can download instagram stories, highlights, IGTV, and tagged posts, instead of just posts of the target profile. Following through its documentations, I wrote three scripts:

  1. For Stories

#!/bin/bash
instaloader --dirname-pattern={profile} --filename-pattern=Stories/{date_utc:m-H-S} $1 --stories --no-profile-pic --no-posts --no-video-thumbnails -F --login=<myprofile>

To use it, suppose the script name is igs.sh, and <target> is the username we want to download, then we would do:

$./igs.sh <target>

What the script did is to take an argument as the target username, and --dirname-pattern={profile} would create a folder with the target's username as its folder name.
Then, with the --filename-pattern=Stories/{date_utc:m-H-S} argument, it would create a folder called "Stories" inside that target username.
The downloaded stories along with its metadata is stored inside that folder.
  1. For Highlights

#!/bin/bash
instaloader --dirname-pattern={profile} --filename-pattern=Highlights/{date_utc:m-H-S} $1 --highlights --no-profile-pic --no-posts --no-video-thumbnails -F --login=<myprofile>

To use it, suppose the script name is igh.sh, and <target> is the username we want to download, then we would do:

$./igh.sh <target>

What the script did is to take an argument as the target username, and --dirname-pattern={profile} would create a folder with the target's username as its folder name.
Then, with the --filename-pattern=Highlights/{date_utc:m-H-S} argument, it would create a folder called "Highlights" inside that target username.
The downloaded highlights along with its metadata is stored inside that folder.
The only limitation is that I couldn't find a way for it to download individual highlights into separate folders.
And I was too lazy to work around it, so yes, it would dump all highlighted stories inside a single Highlight folder.
  1. For IGTV

#!/bin/bash
instaloader --dirname-pattern={profile} --filename-pattern=IGTV/{date_utc:m-H-S} $1 --igtv --no-profile-pic --no-posts --no-video-thumbnails -F --login=<myprofile>

To use it, suppose the script name is igtv.sh, and <target> is the username we want to download, then we would do:

$./igtv.sh <target>

What the script did is to take an argument as the target username, and --dirname-pattern={profile} would create a folder with the target's username as its folder name.
Then, with the --filename-pattern=IGTV/{date_utc:m-H-S} argument, it would create a folder called "IGTV" inside that target username.
The downloaded IGTVs along with its metadata is stored inside that folder.

Conclusion

I use both programs as they have their own strengths and weaknesses. Instalooter is very useful for downloading posts because it tricked Instagram into thinking that we accessed the posts from a web browser. Then it would automatically downloads all the posts from the newest posts to the oldest.

I don't know how Instaloader approached it, as I couldn't find it in its documentation. However it downloaded along the metadatas, including its captions. It also downloads posts from the newest to the oldest, but I find it taking a rather long time if the posts approached some hundreds of posts.

I have to use both, as Instalooter is very quick at downloading instagram posts, and Instaloader is very capable on downloading Stories, Highlights, and IGTVs.

Warning

Do not use them too often, sequentially, or in parallel instances. You could, but use it at your own discretion.

Why? I got logged out from my instagram app, as it suspected that my account is being used by a bot. Well, it wasn't wrong, but I am the one that initiated the bot.

My fault was that, being too excited, I used the tools extensively. To the point I got a 429 error, too many requests.

I suggests you to use them sparingly, and don't download thousands of posts in a single day.

Leave a reply
Your name (required):

Your comment (required):


Page Actions

Recent Changes

Group & Page

Back Links