Edit : Disclaimer : I am not responsible for any damage that may happen while following this guide. Read every step and make sure you understand them before doing anything.
Here's a quick how-to guide to use gallery-dl (for instagram) :
1. Download and install python (make sure to add python to path during install, it's a checkbox to tick)
2. Download the latest
, I use the portable .exe but you can also install it to use the "gallery-dl" command anywhere on your computer.
3. Create a folder C:\Users\[user]\AppData\Roaming\gallery-dl
4. Download the
with default values
5. Put that file in the folder you created in step 3 and rename it to config.json (make sure you enabled the option to change file extensions)
6. Open config.json with notepad, ctrl+F "insta" to go to the instagram options, and use these options :
I will explain in detail what these options do later.
7. In the main extractor options, all the way at the top of the config file, make sure your "user-agent" matches your browser's user agent. You can check what your browser user agent is on
. Simply copy everything between quotation marks and replace what you have in your config file. It should look like this :
8. Make another browser profile. For example you can make another one in firefox by running "Firefox.exe -p", which will open the profile manager.
9. On this secondary browser profile, log in the instagram account you want to use to download from gallery-dl. This means that you will be able to download from private profiles that this account has access to (follows). Do not use your main account, the risk of getting banned is not zero.
10. Install a brower extension that lets you export cookies to a .txt file. I use
on Firefox.
11. Using this extension, export cookies for instagram.com. This will give you a file called "cookies-instagram-com.txt". You can put that file anywhere.
12. The command line (in cmd) you will use to download is :
I recommend saving that command line in a txt file somewhere so you don't have to type it every time.
Note that if you're using the portable gallery-dl.exe, you will need to cd to the folder that contains the .exe before using the command.
You can use that command line to download anything from instagram. For example : "gallery-dl --cookies "C:\[your path that leads to the cookies file]\cookies-instagram-com.txt"
".
This will download every post, reel, and the avatar of those two profiles. You can put as many urls in a row separated by a space as you want. You can add links to stories to download stories, links to highlights to download highlights, or even
to download ALL the highlights of a user.
That's it ! copy/paste as many urls as you want and watch gallery-dl download them.
Regarding the options in step 6, the options I gave will do this :
- for an account url, it will download every post, reel, and the avatar of that account.
- the program will wait 8 to 12 seconds between each url and 0.5 to 2 secs between each file. This is to reduce the risk that instagram detects you.
- the program will download videos.
- the program will create a folder named instagram, and within that folder, a folder for each account. For example "C:/yourpath/Instagram/sophiadiamond".
- the program will skip files already downloaded before, and will abort the download of the current url if 25 consecutive files were skipped. This is to reduce the number of requests to instagram, which reduces the risk to be detected.
- the avatar/posts/reels will be together in the account folder. Stories and highlights will have their own folder within the account folder. For example "C:/yourpath/Instagram/sophiadiamond/Stories".
Note that I don't use any options to change the filenames, with these options, files will have the default filename as it is on the instagram servers. If you want to customize filenames, for example to include the date in them, refer to gallery-dl
, or search on reddit... I'm sure somebody already asked how to do just that on r/DataHoarders.