Instagram temporary locked
See original GitHub issueDescribe the bug I’ve been letting instaloader run every 5 min for the last few months. Yesterday, it raised a 400 Bad Request exception and when I went to instagram I was met with a temporarily locked page and was forced to change my password. I changed the password and re-created the instaloader-session file with the new credentials and restarted instaloader. All was working fine until today at 03:00 AM where it started having the same issues. I went to the instagram page and I was temporarily locked again.
To Reproduce Steps to reproduce the behavior: (e.g. Instaloader command line) It’s a python script that I have running against profiles on a sql table on a schedule every 5 min (each iteration runs against 1 profile only. The next profile runs on the next iteration). It runs in order the following instaloader functions:
- get_posts()
- download_post()
- get_tagged_posts()
- download_post()
- get_stories()
- get_items()
- download_storyitem()
- get_items()
Expected behavior A clear and concise description of what you expected to happen (even if it seems obvious). To run instaloader without raising 400 Bad Request exceptions which may be the reason or a result of my account being locked.
Error messages and tracebacks If applicable, add error messages and tracebacks to help explain your problem.
Job "update_instagram_profile (trigger: cron[year='*', month='*', day='*', hour='*', minute='*/5'], next run at: 2020-10-05 07:55:00 UTC)" raised an exception
Traceback (most recent call last):
File "/workspace/environment/lib/python3.8/site-packages/apscheduler/executors/base.py", line 125, in run_job
retval = job.func(*job.args, **job.kwargs)
File "/workspace/social_network_apps/instagram/functions.py", line 155, in update_instagram_profile
raise _e
File "/workspace/social_network_apps/instagram/functions.py", line 99, in update_instagram_profile
_instagram_profile_object = retrieve_instagram_profile(
File "/workspace/social_network_apps/instagram/functions.py", line 10, in retrieve_instagram_profile
_instagram_profile_object = instaloader.Profile.from_username(instaloader_object.context, db_profile_object.instagram_name)
File "/workspace/environment/lib/python3.8/site-packages/instaloader/structures.py", line 560, in from_username
profile._obtain_metadata() # to raise ProfileNotExistException now in case username is invalid
File "/workspace/environment/lib/python3.8/site-packages/instaloader/structures.py", line 604, in _obtain_metadata
metadata = self._context.get_json('{}/'.format(self.username), params={})
File "/workspace/environment/lib/python3.8/site-packages/instaloader/instaloadercontext.py", line 406, in get_json
raise QueryReturnedBadRequestException("400 Bad Request")
instaloader.exceptions.QueryReturnedBadRequestException: 400 Bad Request
Instaloader version
instaloader --version
output.
4.5.3
Additional context Add any other context about the problem here. I will change the schedule to run every 7 min and see if the problem is the timer. (shouldn’t be since it has been running fine for months now. Maybe instagram changed something on their side?)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:44 (3 by maintainers)
Top GitHub Comments
Ok, so I haven’t had any issues for the past few days.
Here is what I have done:
I believe the last point is the dominant one as I believe instagram is currently checking for simultaneous active sessions and locking the account if an account matches this criteria. The best way to confirm this is if someone who is having the same issue, to not use instagram on the phone or web browser when instaloader is running.
@sotiris-bos I’m using the instaloader python module in a python script. Not the CLI.
Below is the full code of how I’m using instaloader and a cron scheduler.
It could use some optimization for sure, but it works so I didn’t bother with optimization.
You will need to install
apscheduler
which this uses to schedule cronjobs.