Skip to content

Instantly share code, notes, and snippets.

@arwankhoiruddin
Created August 15, 2017 01:43
Show Gist options
  • Save arwankhoiruddin/324e775a1b3fe1ff1e6b123dab96311c to your computer and use it in GitHub Desktop.
Save arwankhoiruddin/324e775a1b3fe1ff1e6b123dab96311c to your computer and use it in GitHub Desktop.
import sys
import os
sys.path.append(os.path.abspath("yourpath/Instagram-API-python/InstagramAPI"))
from InstagramAPI import InstagramAPI
import time
import random
import requests
def getUID(usernameTarget):
r = requests.get('https://www.instagram.com/' + usernameTarget+ '/?__a=1')
parsed_r = r.json()
return parsed_r['user']['id']
user = 'yourname'
pwd = 'yourpass'
uID = getUID('instaUsername') # user ID whose followers are to be followed
api = InstagramAPI(user, pwd)
api.login()
api.getUserFollowers(uID)
users = api.LastJson['users']
for user in users:
api.follow(user['pk'])
print 'this user is followed'
print '====================='
time.sleep(random.randint(30, 480)) # have some time to wait to prevent instagram suspend
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment