Skip to content

Instantly share code, notes, and snippets.

@converge
Created December 15, 2018 14:56
Show Gist options
  • Save converge/46e0c4542176d10796f24aa328269f0a to your computer and use it in GitHub Desktop.
Save converge/46e0c4542176d10796f24aa328269f0a to your computer and use it in GitHub Desktop.
""" Quickstart script for InstaPy usage """
# imports
from instapy import InstaPy
from instapy.util import smart_run
from random import sample
from random import randint
from time import sleep
# login credentials
insta_username = ''
insta_password = ''
blacklist = ['']
tags = ['']
locations = ['']
accounts_to_follow = ['']
def get_accounts(): 1,1 Top
return sample(accounts_to_follow, 3)
def get_locations():
return sample(locations, 3)
def get_likes_n_times():
return randint(40, 65)
def get_tags():
return sample(tags, 3)
def get_follow_n_times():
return randint(50, 79)
def get_random_sleep():
return randint(60, 440)
def get_unfollow_n_times():
return randint(48, 67)
# get an InstaPy session!
# set headless_browser=True to run InstaPy in the background
session = InstaPy(username=insta_username,
password=insta_password,
headless_browser=True,
use_firefox=True,
proxy_address='',
proxy_port=3128,
bypass_suspicious_attempt=True)
with smart_run(session):
# general settings
session.set_skip_users(skip_private=False,
private_percentage=100)
session.set_relationship_bounds(enabled=True,
delimit_by_numbers=True,
max_followers=7590,
min_followers=200,
min_following=50)
session.set_dont_include(blacklist)
# activity
session.like_by_locations(get_locations(), amount=get_likes_n_times(), skip_top_posts=False)
sleep(get_random_sleep())
session.follow_user_followers(get_accounts_to_follow(), amount=get_follow_n_times(), randomize=True)
sleep(get_random_sleep())
session.set_user_interact(amount=2, percentage=70, randomize=True, media='Photo')
session.follow_likers(get_accounts(), photos_grab_amount=10, follow_likers_per_photo=20, randomize=True, sleep_delay=600, interact=True)
sleep(get_random_sleep())
session.follow_user_followers(get_accounts_to_follow(), amount=get_follow_n_times(), randomize=True)
sleep(get_random_sleep())
session.follow_user_followers(get_accounts_to_follow(), amount=get_follow_n_times(), randomize=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment