Created
August 15, 2017 01:43
-
-
Save arwankhoiruddin/324e775a1b3fe1ff1e6b123dab96311c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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