incandenza-11 / blockout2024

Automated script for BlockOut2024
15 stars 6 forks source link

Too many requests #1

Closed fergusonturd closed 3 months ago

fergusonturd commented 3 months ago

When running the script for the first time, I encountered an error that Instragram blocked me from doing the same action too many times in a row. Possibly a direct response to scripts like this.

My suggestion is to perhaps put a longer timeout between blocks, or to put in "dummy" actions between each block to mask the behavior.

Successfully logged in to Instagram.
Reading usernames from file: instagram_usernames.txt
Blocking users...
User ritaora with id 189379530 blocked successfully.
User rhode with id 10580369975 blocked successfully.
User pleasing with id 47442130920 blocked successfully.
User alix_earle with id 28381151 blocked successfully.
User ethanhawke with id 6762222913 blocked successfully.
User davidbeckham with id 186904952 blocked successfully.
User honeymoon with id 1707509864 blocked successfully.
User tyla with id 1131049833 blocked successfully.
User meganfox with id 1376331573 blocked successfully.
User ameliadimz with id 215516840 blocked successfully.
User jbayleaf with id 242061899 blocked successfully.
User sydney_sweeney with id 8140453 blocked successfully.
User icespice with id 2957881817 blocked successfully.
User brittany_broski with id 18538197425 blocked successfully.
User dink818 has already been blocked or does not exist.
User juliannemoore with id 410374974 blocked successfully.
User simoneashley with id 22922666 blocked successfully.
User bellapoarch with id 2964949070 blocked successfully.
User iamkristindavis with id 366531215 blocked successfully.
User jackharlow with id 18838961 blocked successfully.
User getsafely with id 45689546280 blocked successfully.
User lilyjamesofficial with id 1415621358 blocked successfully.
User radhidevlulkia has already been blocked or does not exist.
User maccosmeticsusa with id 53680474916 blocked successfully.
User kelloggsus with id 964407776 blocked successfully.
User naomi with id 243542277 blocked successfully.
User theoutset with id 43205613960 blocked successfully.
User leniklum with id 24840579518 blocked successfully.
User justineskye with id 10950425 blocked successfully.
User asaprocky with id 10685362 blocked successfully.
User dojacat with id 46335750 blocked successfully.
User sabrinacarpenter with id 8713286 blocked successfully.
User ellefanning with id 3009345727 blocked successfully.
User reginaspektor with id 266707303 blocked successfully.
User jakegyllenhaal with id 5964238114 blocked successfully.
User kevinjonas with id 24656016 blocked successfully.
User vogue with id 4329108192 blocked successfully.
User nabela with id 211322151 blocked successfully.
User colbertlateshow with id 1514843460 blocked successfully.
User yitty with id 6505739 blocked successfully.
User mikaylajmakeup with id 1451371362 blocked successfully.
User kardashianshulu with id 50230817175 blocked successfully.
User karolg with id 46864839 blocked successfully.
User billieeilish with id 28527810 blocked successfully.
User cetaphilus with id 327543926 blocked successfully.
User fentybeauty with id 2999682241 blocked successfully.
User maitreyiramakrishnan with id 2316489743 blocked successfully.
User ritaora has already been blocked or does not exist.
User usher with id 40949744 blocked successfully.
User noatishby has already been blocked or does not exist.
User piersmorgan with id 1322638707 blocked successfully.
User natashaelie with id 22255044 blocked successfully.
User ddlovato with id 189393625 blocked successfully.
User brunomars with id 20053826 blocked successfully.
User joebiden with id 5511100943 blocked successfully.
User jasonsegel with id 52143305794 blocked successfully.
User rylan with id 181455435 blocked successfully.
User haleyybaylee with id 197441822 blocked successfully.
User mosalah with id 524226044 blocked successfully.
User trevornoah with id 31115504 blocked successfully.
User noahschnapp with id 343716991 blocked successfully.
User taylorswift with id 11830955 blocked successfully.
User kimkardashian with id 18428658 blocked successfully.
User gal_gadot with id 20788692 blocked successfully.
User jerryseinfeld with id 1345515184 blocked successfully.
User jamieleecurtis with id 1642107034 blocked successfully.
User lievschreiber with id 2895391820 blocked successfully.
User amyschumer with id 181037639 blocked successfully.
User michaelkirkdouglas with id 9855196432 blocked successfully.
User sharonosbourne with id 526892588 blocked successfully.
User therealdebramessing with id 211787485 blocked successfully.
User noahschnapp has already been blocked or does not exist.
User ryanmurphyproductions with id 4689177375 blocked successfully.
User zacharylevi with id 50473493 blocked successfully.
User georgelopez with id 38811207 blocked successfully.
User markhamill with id 1380059350 blocked successfully.
User howiemandel with id 19746054 blocked successfully.
User justinbieber with id 6860189 blocked successfully.
User therock with id 232192182 blocked successfully.
User madonna with id 181306552 blocked successfully.
User taylorswift has already been blocked or does not exist.
User natalieportman with id 6414707404 blocked successfully.
User sarahkatesilverman with id 225570730 blocked successfully.
User krisjenner with id 144646783 blocked successfully.
User meghanmccain with id 21088427 blocked successfully.
User blakelively with id 1437529575 blocked successfully.
User vancityreynolds with id 1942463581 blocked successfully.
Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.11/site-packages/instagrapi/mixins/private.py", line 359, in _send_private_request
    response.raise_for_status()
  File "/opt/homebrew/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://i.instagram.com/api/v1/friendships/block/53452385/

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/joey/Documents/Projects/Blockout2024/blockout2024/main.py", line 34, in <module>
    main()
  File "/Users/joey/Documents/Projects/Blockout2024/blockout2024/main.py", line 30, in main
    client.block_users()
  File "/Users/joey/Documents/Projects/Blockout2024/blockout2024/drivers/instagram.py", line 47, in block_users
    self.client.user_block(user_id)
  File "/opt/homebrew/lib/python3.11/site-packages/instagrapi/mixins/user.py", line 873, in user_block
    result = self.private_request(f"friendships/block/{user_id}/", data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/instagrapi/mixins/private.py", line 541, in private_request
    raise e
  File "/opt/homebrew/lib/python3.11/site-packages/instagrapi/mixins/private.py", line 526, in private_request
    self._send_private_request(endpoint, **kwargs)
  File "/opt/homebrew/lib/python3.11/site-packages/instagrapi/mixins/private.py", line 394, in _send_private_request
    raise FeedbackRequired(
instagrapi.exceptions.FeedbackRequired: feedback_required: We limit how often you can do certain things on Instagram to protect our community. Tell us if you think we made a mistake.
fergusonturd commented 3 months ago

Trying to add a randomized delay to instagram.py per this guide: https://subzeroid.github.io/instagrapi/usage-guide/best-practices.html

client.delay_range = [1, 4]

fergusonturd commented 3 months ago

I re-ran it with the delay on my main account, so far so good. Entering a pull request.

I am going to try to re-run on my alt account shortly.

fergusonturd commented 3 months ago

Success on my alt account! @sandrasgg if you accept the pull request then let's close this issue. Thanks!

infinite-wait commented 3 months ago

@fergusonturd Merged, thank you so much! 🚀