SHARE
TWEET

InstagramFollowBot

a guest Nov 19th, 2019 279 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Recommend following accounts like fortnite, callofduty, etc you will get followers (mainly bots) from following and un-following
  2. # Just input account details, user to follow, and what you where you want info outputted to.
  3.  
  4. #Py3
  5.  
  6. import requests, getpass, time
  7.  
  8. AccUser = input("[?] Username: ")
  9. AccPass = getpass.getpass(prompt="[?] Password: ")
  10. AccToFollow = input("[?] Account To Follow: ")
  11. OutputFile = input("[?] Output file: ")
  12. OutputF = open(OutputFile, "w")
  13. UserIDUrl = f'https://www.instagram.com/{AccToFollow}/?__a=1'
  14. RequestID = requests.get(UserIDUrl)
  15. UserID = RequestID.json()['logging_page_id'].split('_')[1]
  16. refer = f'https://www.instagram.com/{AccToFollow}/'
  17. FollowURL = "https://www.instagram.com/web/friendships/%s/follow/" % (UserID)
  18. UnfollowURL = "https://www.instagram.com/web/friendships/%s/unfollow/" % (UserID)
  19.  
  20.  
  21. def Follow(user, passw, acc2follow):
  22.     s = requests.session()
  23.     GetTok = "https://www.instagram.com/accounts/login/"
  24.     Grab = s.get(GetTok)
  25.     LoginURL = 'https://www.instagram.com/accounts/login/ajax/'
  26.     Headd = {
  27.         'accept': '*/*',
  28.         'accept-encoding': 'gzip, deflate, br',
  29.         'accept-language': 'en-US,en;q=0.9',
  30.         'content-type': 'application/x-www-form-urlencoded',
  31.         'origin': 'https://www.instagram.com',
  32.         'referer': 'https://www.instagram.com/accounts/login/',
  33.         'user-agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.2; zh) AppleWebKit/522.13.1 (KHTML, like Gecko) Version/3.0.2 Safari/522.13.1',
  34.         'x-csrftoken': Grab.cookies.get_dict()['csrftoken'],
  35.         'x-instagram-ajax': '1',
  36.         'x-requested-with': 'XMLHttpRequest'
  37.     }
  38.     LoginData = {
  39.         'username': user,
  40.         'password': passw,
  41.         'queryParams': '{}'
  42.     }
  43.     x = 0
  44.     try:
  45.         AccLogin = s.post(LoginURL, headers=Headd, data=LoginData)
  46.         if AccLogin.json()['authenticated']:
  47.             OutputF.write(f"{AccLogin.json()} | {x}")
  48.             x += 1
  49.             print(f"Logged in | {user}")
  50.             head = {
  51.                 'accept': '*/*',
  52.                 'accept-encoding': 'gzip, deflate, br',
  53.                 'accept-language': 'en-US,en;q=0.9',
  54.                 'content-type': 'application/x-www-form-urlencoded',
  55.                 'origin': 'https://www.instagram.com',
  56.                 'referer': refer,
  57.                 'user-agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.2; zh) AppleWebKit/522.13.1 (KHTML, like Gecko) Version/3.0.2 Safari/522.13.1',
  58.                 'x-csrftoken': AccLogin.cookies.get_dict()['csrftoken'],
  59.                 'x-instagram-ajax': '1',
  60.                 'x-requested-with': 'XMLHttpRequest'
  61.             }
  62.             Followed = 0
  63.             Unfollowed = 0
  64.             while True:
  65.                 try:
  66.                     RequestFollow = s.post(FollowURL, headers=head, data={})
  67.                     try:
  68.                         if RequestFollow.status_code == 200:
  69.                             x += 1
  70.                             OutputF.write(f"{RequestFollow.json()} | {x}")
  71.                             Followed += 1
  72.                             print(f"[!] {user} followed {acc2follow} | {RequestFollow.status_code} ")
  73.                             time.sleep(20)
  74.                             try:
  75.                                 Unfollow = s.post(UnfollowURL, headers=head)
  76.                                 if Unfollow.status_code == 200:
  77.                                     Unfollowed += 1
  78.                                     x += 1
  79.                                     OutputF.write(f"{Unfollow.json()} | {x}")
  80.                                     print(f"[!] {user} unfollowed {acc2follow} | Followed [{Followed}] times - Unfollowed [{Unfollowed}] times | {Unfollow.status_code}")
  81.                                     time.sleep(20)
  82.                             except Exception as e : print(e)
  83.                         else : print(f"[-] {user} failed to follow {acc2follow}")
  84.                     except Exception as e : print(e)
  85.                 except Exception as e : print(e)
  86.  
  87.         else : print(f"[-] {user} unable to login")
  88.     except Exception as e : print(e)
  89.  
  90. Follow(AccUser, AccPass, AccToFollow)
  91.  
  92. OutputF.close()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top