instaloader: 429 Too Many Requests error for an account that scrapes Instagram stories of up to over 270 accounts twice nightly
Describe the bug I currently split my Instagram story scraping into right now four accounts given the number of people I follow is quite high (my main account is following about 584). However, it seems one of my accounts get hit with a hard 429 Too Many Requests error, even though I scrape Instagram stories roughly twice a day. That account has been scraping about 277 accounts at a time, which is pretty high to a point that I could hit Instagram API limits easily. It’s been working normal since around September 20, and I’ve been using Instaloader for Instagram story scraping following my favorite site used to do as such shut down last month.
To Reproduce I created separate folders for each account that I use to scrape Instagram stories. For each folder, I set up a custom CMD file:
@echo off
instaloader +args.txt --no-posts --no-profile-pic --stories --no-metadata-json
And for each args.txt in the folder are the following:
--login=<IG username>
--password=<IG password>
--fast-update
account1
account2
account3
etc...
...
accountn
where account1, account2, account3, accountn are the list of accounts that I follow that I want to scrape its Instagram stories.
Expected behavior It should not pop out the following error below. For instances where I’m scraping more than 75 accounts for that particular account I’m using to scrape Instagram stories, there should be a Too many queries in the last time cooldown message roughly every 10-12 minutes.
Error messages and tracebacks
Loaded session from <redacted>.
Logged in as <redacted>.
JSON Query to 345insta/feed/: 429 Too Many Requests [retrying; skip with ^C]
Requests within last 10/11/20/22/30/60 minutes grouped by type:
<redacted>: 1 1 1 1 1 1
* other: 1 1 1 1 1 1
Instagram responded with HTTP error "429 - Too Many Requests". Please
do not run multiple instances of Instaloader in parallel or within
short sequence. Also, do not use any Instagram App while Instaloader
is running.
'The request will be retried in 666 seconds, at 18:42.
As you see, that was my only request within the last hour. I was just getting started my first of two Instagram story scraping sessions per day, roughly around 6:30 PM and 11:30 PM each night. But it didn’t work. I tried removing the account from the JSON Query, but when I tried again, I received the same 429 error again. Once it picks up all accounts, it will start to ‘scrape’ (receive and download) stories content (images and, if available, video) to my hard drive.
Instaloader version 4.5.3
Additional context This account was one of three accounts that I am purposely using for story scraping after someone suggested me on Reddit. I was not receiving login errors. When I logged in to the account that was impacted by above issue at Instagram’s website, I’m not receiving error messages on the site either (though I don’t follow any other accounts with that account involved, plus two additional accounts for the purposes of Instagram story scraping).
I tried the other three accounts (my main account and two additional accounts for scraping-only duties including one that focused on a subset group of accounts based on the theme of following members that are or were members of a well-known series of Japanese female idols), and they were working just fine, except for my main account apparently, it got hit with the same error as well midway…
Loaded session from <redacted>.
Logged in as ryandtw. (note: this is my main IG account)
JSON Query to imsa_racing/feed/: 429 Too Many Requests [retrying; skip with ^C]
Requests within last 10/11/20/22/30/60 minutes grouped by type:
<redacted>: 1 1 1 1 1 1
* other: 39 39 39 39 39 39
Instagram responded with HTTP error "429 - Too Many Requests". Please
do not run multiple instances of Instaloader in parallel or within
short sequence. Also, do not use any Instagram App while Instaloader
is running.
The request will be retried in 573 seconds, at 19:45.
Also, the clause “logged-in accesses do not seem to be affected” does not apply to this issue - as explicitly stated, I was logged in for all instances.
*I put <redacted> over any material that can be considered private, particularly login username and password. Also, to clarify, I am running all four accounts for Instaloader under the same, single IP address.
EDIT: There was a similar issue (#822) where that person was also having a 429 error as well. See also issue #774.
Anyways, I’ve been scraping Instagram stories for years, but it seems Instagram Facebook (the parent company of Instagram) is closing more and more doors, limiting my choices on how I view and download stories of accounts that I follow. Going through each Instagram account on the website is inefficient and time-consuming, given how many accounts I follow. When my favorite website to scrape Instagram stories shut down last month, that was a large hole that Facebook covered up for scraping these stories (okay, it wasn’t shut down by Facebook, but the owner of the site was concerned about ‘legal issues’, so he shut it down). Instaloader is proving me to be the last hole out right now, but I’m fearing Facebook is closing that hole as well. F Facebook.
There’s another site called gramsave(dot)com but it only works for extracting actual Instagram posts, not downloading Instagram stories. 😦
Or wait. Is Instagram down or something? Oh My IG (Chrome extension for regular Instagram posts, not stories) is still working fine.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 33 (2 by maintainers)
it works for me… reboot your router.
Removing the “feed/” seems to work. https://github.com/instaloader/instaloader/blob/f4ecfea64cc11efba44cda2b44c8cfe41adbd28a/instaloader/structures.py#L613
@aandergr This is not fixed at all, many of us are having this problem, just read the comments here…
When using 4.6, 429 gets returned much more often, compared to 4.5.5. Within an hour when using 4.6, 429 gets returned dozens of times, while on 4.5.5 in that same hour, the process goes smoothly without a single error. I suspect it’s because of https://github.com/instaloader/instaloader/pull/712 - now it’s making these “more expensive” requests, and hits the rate limit faster. If that’s the case, then having an --option to choose what kind of quality to get (and what kind of request to make) could solve this problem.
It is mostly caused by additional higher resolution image url fetches done by
_iphone_structfunctions. When I disable this 429 errors become much rarer. It would be nice to have an option to disable this additional fetches from the command line. Those higher resolution images do not worth it.In my case (I use separate accounts for my Android and instaloader), “400 Bad Request” means “account temporarily blocked by IG”. When I login with browser using the account for instaloader, IG requires me to verify my email and reset the password. Following the instructions, Instaloader works again.
However, it seems that IG blocks accounts more frequently than before. I hadn’t been blocked for months, but blocked 9 times in the last 3 months.