subzeroid / instagrapi

🔥 The fastest and powerful Python library for Instagram Private API 2024
https://hikerapi.com/p/bkXQlaVe
MIT License
4.37k stars 684 forks source link

[BUG] running my script logs me out of my account on my other devices, logging back in crashes script #1314

Open dylanwdw opened 1 year ago

dylanwdw commented 1 year ago

I wrote a python script to periodically upload media to my Instagram page. When I run the script, I get a message on my phone saying I've been logged out of instagram. If i dont log back in, the script works perfectly fine. However if I try to log in again, the script will crash upon the next media upload.

"instagrapi.exceptions.PhotoNotUpload: {"message": "login_required", "status": "faill"}

steps to reproduce: I copied my login function from the "best practices" page.

noqcks commented 1 year ago

Some questions:

claell commented 1 year ago

@dylanwdw sounds like Instagram saw some suspicious activities.

I also have this problem recently (logout or other verification challenge needed after minimal actions). Not sure what causes this, as my scripts didn't change that much. Haven't been running them for some time (some months), though. So not sure whether this is just Instagram detecting things or whether it's related to updating the Instagrapi package (and thus a valid issue; in the past, it usually wasn't the package's fault, exception: #1286).

@noqcks

noqcks commented 1 year ago

@claell try and limit interactions until you can complete one run of your bot without instagram terminating the session.

Instagram thinks you're a bot and is terminating the session.

claell commented 1 year ago

I can do that, but then the session will apparently get terminated some time after? At least, I experienced that the client was not working for further things when I tried again. Maybe that is one action too much already, then? It's just login, follow and send two messages; done. Maybe already too much at the moment.

Also, I experienced that some time after (like 20 minutes), Instagram asks me to do a challenge like phone verification in the app (bot didn't run there).

Might be true that the account is just very limited right now, and I just need to wait. It seems that the limits currently are much tighter than anything I have experienced before.

Allaux commented 1 year ago

Hello, I am logged out after 10 minutes and 20 requests to direct message, how and how i can sole this ? When i use other code its work and not logged me out. Other code he work great : https://github.com/Willy-JL/InstaDownloader , can you check for update your code for not rate limted like this code ?