Skip to content

Instantly share code, notes, and snippets.

@r6m
Created December 16, 2019 08:34
Show Gist options
  • Save r6m/aa05b3f223e2a94c0e7223132e0912ab to your computer and use it in GitHub Desktop.
Save r6m/aa05b3f223e2a94c0e7223132e0912ab to your computer and use it in GitHub Desktop.
instapy
"""
This template is written by @Nuzzo235
What does this quickstart script aim to do?
- This script is targeting followers of similar accounts and influencers.
- This is my starting point for a conservative approach: Interact with the
audience of influencers in your niche with the help of 'Target-Lists' and
'randomization'.
NOTES:
- For the ease of use most of the relevant data is retrieved in the upper part.
"""
import random
from instapy import InstaPy
from instapy import smart_run
# login credentials
insta_username = '##########'
insta_password = '##########'
# restriction data
# dont_likes = ['#exactmatch', '[startswith', ']endswith', 'broadmatch']
# ignore_users = ['user1', 'user2', 'user3']
""" Prevent commenting on and unfollowing your good friends (the images will
still be liked)...
"""
# friends = ['friend1', 'friend2', 'friend3']
""" Prevent posts that contain...
"""
# ignore_list = []
# TARGET data
""" Set similar accounts and influencers from your niche to target...
"""
targets = ['digiato', 'alizakariaee2', 'masih_poolinejad_1', 'cafebazaar', 'digikalacom', 'digiato']#, 'quizofkings']
""" Skip all business accounts, except from list given...
"""
# target_business_categories = ['category1', 'category2', 'category3']
# COMMENT data
comments = ['عالی! @{}',
'جالبه @{}',
'عالیه :thumbsup:',
':open_mouth:',
' @{}',
'@{} :thumbsup:',
'@{} 👏',
':raised_hands: Yes!',
'@{} :muscle:']
# get a session!
session = InstaPy(username=insta_username,
password=insta_password,
headless_browser=True,
disable_image_load=True,
multi_logs=True)
# let's go! :>
with smart_run(session):
# HEY HO LETS GO
# general settings
# session.set_dont_include(friends)
# session.set_dont_like(dont_likes)
# session.set_ignore_if_contains(ignore_list)
# session.set_ignore_users(ignore_users)
session.set_simulation(enabled=True)
session.set_relationship_bounds(enabled=True,
potency_ratio=None,
delimit_by_numbers=True,
max_followers=7500,
max_following=3000,
min_followers=25,
min_following=25,
min_posts=3)
session.set_skip_users(skip_private=True,
skip_no_profile_pic=True,
skip_business=True)
session.set_user_interact(amount=3, randomize=True, percentage=80,
media='Photo')
session.set_do_like(enabled=True, percentage=80)
# session.set_do_comment(enabled=True, percentage=25)
# session.set_comments(comments, media='Photo')
session.set_do_follow(enabled=True, percentage=75, times=1)
# activities
# FOLLOW+INTERACTION on TARGETED accounts
""" Select users form a list of a predefined targets...
"""
number = random.randint(3, 5)
random_targets = targets
if len(targets) <= number:
random_targets = targets
else:
random_targets = random.sample(targets, number)
""" Interact with the chosen targets...
"""
session.follow_user_followers(random_targets,
amount=random.randint(50, 68),
randomize=True, sleep_delay=150,
interact=True)
# UNFOLLOW activity
""" Unfollow nonfollowers after one day...
"""
session.unfollow_users(amount=random.randint(75, 100),
InstapyFollowed=(True, "nonfollowers"),
style="FIFO",
unfollow_after=24 * 60 * 60, sleep_delay=150)
""" Unfollow all users followed by InstaPy after one week to keep the
following-level clean...
"""
session.unfollow_users(amount=random.randint(75, 100),
InstapyFollowed=(True, "all"), style="FIFO",
unfollow_after=168 * 60 * 60, sleep_delay=200)
""" Joining Engagement Pods...
"""
session.join_pods()
"""
Have fun while optimizing for your purposes, Nuzzo
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment