├── README.md └── autoacceptor.py /README.md: -------------------------------------------------------------------------------- 1 | # Instagram-Auto-Acceptor 2 | A script that automatically accepts all your pending follow requests. 3 | 4 | ## About 5 | This tool bulk accepts follow requests, meaning it accepts all pending requests in your account . It then checks/ scans your account every 9 seconds in default for any pending requests. You may change the delay in seconds, and limit the accounts you will accept in each iteration. Make sure you are already logged on Instagram in the pc you will be using this script in as this does not have a challenge solver yet. 6 | 7 | Your account must be private to use this tool. This tool also works on Mac and Windows. 8 | 9 | ## Picture 10 | ![Picture](https://i.ibb.co/7j0yVXD/Screenshot-293.png) 11 | 12 | ## Usage 13 | ### Get Python 14 | If you dont have python installed, download python 15 | and make sure you click on the 'ADD TO PATH' option during 16 | the installation. 17 | 18 | 1. Pip install requirements 19 | ``` 20 | pip install colorama 21 | pip install halo 22 | pip install requests 23 | ``` 24 | or ```pip3``` on Mac 25 | 26 | 2. Run the script 27 | ``` 28 | python autoacceptor.py 29 | ``` 30 | or ```python3 autoacceptor.py``` on Mac 31 | 32 | Make sure you are in the same directory as the 33 | python file. 34 | 35 | ### How to Use 36 | [DELAY/SLEEP FEATURE] Check follow requests queue every (in seconds) - This tells the program how long to sleep/wait for until it will refresh Instagram again and check for any pending follow requests. 37 | 38 | For this ,you can leave it blank if you don't want any delays but it is RECOMMENDED to put a delay. If you dont, the program will constantly referesh Instagram and you might get detected. 39 | 40 | 1800 seconds is good (It checks every 30 minutes for requests). If you dont' get that much follower requests, you can check every 3600 seconds (better). I recommend puting delays to avoid overloading/spamming the Instagram API. 41 | 42 | [LIMIT FEATURE] Limit number of accounts to accept in each iteration (int value) [Optional] - This tells the program how many accounts you can accept in each iteration. The default value is 75, meaning in each iteration, 75 accounts can be followed in bulk . You can leave this blank, but if you get a large amount of follow requests in a short period of time, you should limit it to under 100. You can customize this. For example, you only want to accept 5 people in each iteration so just type 5. 43 | 44 | Examples: Puting the delay to 3600 and limiting the program to 5. What this will do is it will check the follow requests queue every 3600 seconds and it will only accept 5 accounts for each iteration. For example, you have 100 follow requests. The program will only accept 5 people and you will have to wait 3600 seconds before the next batch of 5 is accepted. 45 | 46 | Close the application or Control + C to stop accepting requests. 47 | 48 | ### To Do 49 | - Add method of solving challenge 50 | - GUI 51 | - More options 52 | -------------------------------------------------------------------------------- /autoacceptor.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import re 3 | import json 4 | from colorama import Fore, init ,Style 5 | import time 6 | import os 7 | from halo import Halo 8 | import random 9 | import platform 10 | 11 | def clear(): 12 | if platform.system().lower() == 'windows': 13 | os.system('cls') 14 | 15 | elif platform.system().lower() == 'linux' or 'darwin': 16 | os.system('clear') 17 | 18 | else: 19 | print('\n' * 120) 20 | 21 | if platform.system().lower() == 'windows': 22 | init(convert=True) 23 | 24 | ITERATION_NUM = 0 25 | ACCOUNTS_ACCEPTED = 0 26 | 27 | class InstagramAccept: 28 | def __init__(self,login_data): 29 | self.url_login = "https://www.instagram.com/accounts/login/ajax/" 30 | self.url_activity = "https://www.instagram.com/accounts/activity/" 31 | self.url = "https://www.instagram.com/" 32 | self.s = requests.Session() 33 | 34 | self.temp_headers = { 35 | "accept": "*/*", 36 | "accept-language": "en-US,en;q=0.9", 37 | "content-type": "application/x-www-form-urlencoded", 38 | "sec-fetch-dest": "empty", 39 | "sec-fetch-mode": "cors", 40 | "sec-fetch-site": "same-origin", 41 | "user-agent" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36", 42 | 43 | } 44 | self.csrf_token = self._get_csrf() 45 | 46 | self.headers = { 47 | "accept": "*/*", 48 | "accept-language": "en-US,en;q=0.9", 49 | "content-type": "application/x-www-form-urlencoded", 50 | "sec-fetch-dest": "empty", 51 | "sec-fetch-mode": "cors", 52 | "sec-fetch-site": "same-origin", 53 | "user-agent" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36", 54 | "x-csrftoken": self.csrf_token, 55 | 56 | } 57 | 58 | self.login_data = login_data 59 | 60 | def login(self) -> bool: 61 | log_in = self.s.post(self.url_login,data=self.login_data,headers=self.headers) 62 | 63 | log_in_dict = json.loads(log_in.text) 64 | 65 | print("[!] Authentication:", log_in_dict['authenticated']) 66 | 67 | if log_in_dict['authenticated']: 68 | return True 69 | return False 70 | 71 | def _get_activity(self) -> list: 72 | print("[!] Getting activity..") 73 | account_activity = self.s.get(self.url_activity) 74 | 75 | sharedData = re.search("window._sharedData = (.*?);", account_activity.text, re.DOTALL).group(1) 76 | 77 | self.activity = json.loads(sharedData) 78 | 79 | return self.activity 80 | 81 | def _analyze_requests(self): 82 | self.edge_follow_requests = self.activity['entry_data']['ActivityFeed'][0]['graphql']['user']['edge_follow_requests']['edges'] 83 | 84 | if not self.edge_follow_requests: 85 | print("[!] No pending users to accept!") 86 | 87 | self.pending_usersID = [] 88 | self.pending_usersUSERNAME = [] 89 | self.pending_usersPFP = [] 90 | self.pending_DICT = [] 91 | 92 | for x in self.edge_follow_requests: 93 | self.pending_usersID.append(x['node']['id']) 94 | self.pending_usersUSERNAME.append(x['node']['username']) 95 | self.pending_usersPFP.append(x['node']['profile_pic_url']) 96 | self.pending_DICT.append(x) 97 | 98 | def _get_csrf(self): 99 | r = self.s.get(self.url, headers=self.temp_headers) 100 | self.csrf_token = re.search('(?<="csrf_token":")\w+', r.text).group(0) 101 | return self.csrf_token 102 | 103 | def accept_requests(self, user_limit): 104 | #Accept all requests after getting user ids 105 | global ACCOUNTS_ACCEPTED 106 | global ITERATION_NUM 107 | 108 | self.csrf_token = self._get_csrf() 109 | self._analyze_requests() 110 | 111 | limit = user_limit 112 | count = 0 113 | 114 | ITERATION_NUM += 1 115 | for a, b in zip(self.pending_usersID,self.pending_usersUSERNAME): 116 | mimic_user = random.randint(0,3) 117 | time.sleep(mimic_user) 118 | 119 | accept_req = self.s.post(f'https://www.instagram.com/web/friendships/{a}/approve/',headers={"x-csrftoken": self.csrf_token}) 120 | 121 | accept_req_dict = json.loads(accept_req.text) 122 | 123 | if accept_req_dict['status'] == "ok": 124 | print(f"[*] Approved {b}'s follow request | id: {a}") 125 | ACCOUNTS_ACCEPTED += 1 126 | count += 1 127 | 128 | else: 129 | print(f"[!] An error has occured.") 130 | 131 | if count >= limit: 132 | print(f'[!] Breaking out of loop. Limit is ', limit) 133 | break 134 | 135 | if platform.system().lower() == 'windows': 136 | os.system(f'title Instagram Auto Acceptor ^| Iterations: {ITERATION_NUM} ^| Accounts accepted: {ACCOUNTS_ACCEPTED}') 137 | 138 | def loop(self,user_limit): 139 | self._get_activity() 140 | self.accept_requests(user_limit) 141 | 142 | def title(): 143 | print(f'''{Fore.RED} 144 | █████╗ ██╗ ██╗████████╗ ██████╗ █████╗ ██████╗ ██████╗███████╗██████╗ ████████╗ ██████╗ ██████╗ 145 | ██╔══██╗██║ ██║╚══██╔══╝██╔═══██╗ ██╔══██╗██╔════╝██╔════╝██╔════╝██╔══██╗╚══██╔══╝██╔═══██╗██╔══██╗ 146 | ███████║██║ ██║ ██║ ██║ ██║ ███████║██║ ██║ █████╗ ██████╔╝ ██║ ██║ ██║██████╔╝ 147 | ██╔══██║██║ ██║ ██║ ██║ ██║ ██╔══██║██║ ██║ ██╔══╝ ██╔═══╝ ██║ ██║ ██║██╔══██╗ 148 | ██║ ██║╚██████╔╝ ██║ ╚██████╔╝ ██║ ██║╚██████╗╚██████╗███████╗██║ ██║ ╚██████╔╝██║ ██║ 149 | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ 150 | {Style.RESET_ALL} 151 | by NightfallGT 152 | ''') 153 | def main(): 154 | s = Style.RESET_ALL 155 | c = Fore.RED 156 | clear() 157 | title() 158 | 159 | if platform.system().lower() == 'windows': 160 | os.system('title Instagram Auto Acceptor ^| Menu') 161 | 162 | input_username = input(f"[{c}x{s}] Instagram Username: ") 163 | input_password = input(f"[{c}x{s}] Instagram Password: ") 164 | 165 | try: 166 | input_delay = int(input(f"[{c}x{s}] Check follow requests queue every (in seconds) [Optional] {c}>{s} ")) 167 | except ValueError: 168 | input_delay = 9 169 | 170 | try: 171 | input_limit = int(input(f"[{c}x{s}] Limit number of accounts to accept in each iteration (int value) [Optional] {c}>{s} ")) 172 | except ValueError: 173 | input_limit = 75 174 | 175 | post = {'username': input_username, 'enc_password': '#PWD_INSTAGRAM_BROWSER:0:0:' +input_password} 176 | 177 | spinner = Halo(text='Loading', spinner='dots', color='red') 178 | 179 | spinner.start() 180 | if platform.system().lower() == 'windows': 181 | os.system('title Instagram Auto Acceptor ^| Loading..') 182 | 183 | i = InstagramAccept(post) 184 | spinner.stop() 185 | 186 | if platform.system().lower() == 'windows': 187 | os.system('title Instagram Auto Acceptor ^| Menu') 188 | 189 | clear() 190 | title() 191 | 192 | spinner2 = Halo(text=f'Sleeping for {input_delay}s', spinner='dots', color='red') 193 | if i.login()== True: 194 | while True: 195 | i.loop(input_limit) 196 | spinner2.start() 197 | time.sleep(input_delay) 198 | spinner2.stop() 199 | else: 200 | print('[!] User has failed to log in') 201 | input() 202 | main() 203 | 204 | if __name__ == "__main__": 205 | main() 206 | 207 | 208 | 209 | --------------------------------------------------------------------------------