Sign inSign up

360allround/quickstart

By 360allround

β€’Updated over 7 years ago

InstaPy Quickstart

Image
0

1.2K

360allround/quickstart repository overview

Disclaimer: Please Note that this is a research project. I am by no means responsible for any usage of this tool. Use on your own behalf. I'm also not responsible if your accounts get banned due to extensive use of this tool.

⁠InstaPy

MIT license built with Selenium built with Python3 Travis Backers on Open Collective Sponsors on Open Collective

⁠Tooling that automates your social media interactions to β€œfarm” Likes, Comments, and Followers on Instagram

Implemented in Python using the Selenium module.

Have an issue? If you should encounter any issue, please first search for similar issues⁠ and only if you can't find any, create a new issue or use the discord channel⁠ for help.

⁠Newsletter: Sign Up for the Newsletter here!⁠
⁠Get the Offical Video Guide: Get it here!⁠

⁠Installation

pip install instapy

That's it πŸ«β˜•


Now all you need is a quickstart script to start InstaPy πŸ₯³

Choose a quickstart script of your choice from the instapy-quickstart⁠ repository to get started πŸ”Ž

You can also copy and paste this basic quickstart into a new text file and save it as .py file.

""" Quickstart script for InstaPy usage """		
# imports		
from instapy import InstaPy		
from instapy import smart_run		
	
# get an InstaPy session!		
session = InstaPy()		
	
with smart_run(session):		
    """ Activity flow """		
    # general settings		
    session.set_dont_include(["friend1", "friend2", "friend3"])		
	
    # activity		
    session.like_by_tags(["natgeo"], amount=10)		

πŸ›° As you've downloaded a quickstart script into your computer, go ahead and run it in the command prompt as:

python quickstart.py --username abc --password 123

PRO:
Read more about passing arguments from the command line interface in the section - Pass arguments by CLI⁠.


⁠🚁 You can provide username & password inside the quickstart script, too!
# inside quickstart script

session = InstaPy(username="abc",    
                  password="123")   

πŸ›Έ Also, if you like to run InstaPy in background, just enable the headless mode!

python quickstart.py -u abc -p 123 --headless-browser

Or do it right inside the quickstart script.

# inside quickstart script

session = InstaPy(username="abc",    
                  password="123",
                  headless_browser=True)  

Until you enable the headless mode, InstaPy will run in the graphical mode where you can watch the ongoing automation in your web browser.

If you've used InstaPy before installing it by pip, you have to move your old data to the new workspace folder for once. Read how to do this here⁠.


⁠Update

pip install instapy -U

⁠Install a specific version
pip install instapy==0.1.1
⁠Uninstall
pip uninstall instapy


⁠Social
⁠Twitter of InstaPy⁠ | Twitter of Tim⁠ | How it works (Medium)⁠ |

Talk about automating your Instagram⁠ | Talk about doing Open-Source work⁠ | Listen to the "Talk Python to me"-Episode⁠

⁠Do you need help ?
Discord channel ⁠
⁠Do you want to support us ?
⁠ paypalme ⁠

Help build InstaPy!
Check out this short guide on how to start contributing!⁠.


⁠Guides
⁠Video tutorials:

Official InstaPy Guide on Udemy⁠

Installation on Windows⁠

Installation on MacOS⁠

Installation on Linux⁠

Installation on DigitalOcean Server⁠

⁠Written Guides:

How to Ubuntu (64-Bit)⁠       

How to RaspberryPi⁠       

⁠Documentation

⁠Table of Contents
⁠Advanced Installation
β πŸ›  Install or update to the unreleased version

For example, there is a bug and its fix is merged to the repo but a newer version of InstaPy [containing that fix] is not yet released to PyPI to be able to be installed or updated by pip.

Then, you can do this to install the actual state of the repo πŸ˜‹

pip install -I https://github.com/timgrossmann/InstaPy/zipball/master

Worths to note that, this installation option does not require Git to be installed, too.
-I flag in there is used to ignore the installed packages and reinstall them instead.

Learn why -I flag is required πŸ”Ž

Since InstaPy's version is not yet being incremented which is the reason you're installing it from a zipball, then if you don't use the -I flag, pip will complain saying,

  • "Hey, I have already installed the x.y.z version! Skipping installation..."

But obviously, even though the version is the same, zipball has the current state of the repository.
That's why you will be able to install the actual state of the repo using the -I flag.


PRO Tip:
Read the section - How to avoid python & pip confusion⁠ πŸ˜„


β βš— Install manually and manage using advanced git commands
⁠For those who want to tweak or enhance InstaPy.

1. Clone InstaPy repository into your computer

git clone https://github.com/timgrossmann/InstaPy.git

2. Navigate to the InstaPy project root directory

cd InstaPy

3. Install the local instapy package

pip install -e .
Learn why -e flag is required πŸ”Ž

Since you're gonna install the local version of InstaPy you'll probably change its code per your need which is the reason you do an advanced installation from a Git source, then if you don't use the -e flag, you'll have to install that local package by pip every time after making a change.

But fortunately, -e flag comes to help;
-e means editable install, so that after editing files you don't need to re-install the package again since it will always refer to the edited files cos with the editable install, it just links the project's location to pip's install location rather than adding them to pip location separately..

or
python setup.py install

⁠⛑ Install into a Virtual Environment
⁠The best way to install InstaPy is to create a virtual environment and install InstaPy there, then, run it from a separate file.
Guide for Pythons >= 3.6 πŸ”Ž
⁠Mac/Linux

1. Clone InstaPy repository into your computer

git clone https://github.com/timgrossmann/InstaPy.git

2. Navigate to the InstaPy project root directory

cd InstaPy

3. Make a virtual environment

python3 -m venv venv

4. Activate the virtual environment

source venv/bin/activate

5. Install the local instapy package

pip install -e .
⁠Windows

1. Clone InstaPy repository into your computer

git clone https://github.com/timgrossmann/InstaPy.git

2. Navigate to the InstaPy project root directory

cd InstaPy

3. Make a virtual environment

python3 -m venv venv

4. Activate the virtual environment

venv\Scripts\activate.bat

5. Install the local instapy package

pip install -e .

If you're not familiar with venv, please read about it here⁠ and use it to your advantage;

  • Running source venv/bin/activate will activate the correct python to run InstaPy. To exit an activated venv run deactivate.
  • Now, copy & paste the quickstart.py python code below and then run your first InstaPy script.
    Remember to run it with python from the venv.
  • To make sure which python is used, run which python which will tell you the active version of python.
  • Whenever you run the script, the virtual environment must be active.
Guide for Pythons < 3.6 πŸ”Ž

1. Make a virtual environment

virtualenv venv

2. Activate the virtual environment

source venv/bin/activate

3. Install the instapy package from Git by using pip

pip install git+https://github.com/timgrossmann/InstaPy.git

If you're not familiar with virtualenv, please read about it here⁠ and use it to your advantage;

In essence,

  • This is be the only python library you should install as root (e.g., with sudo).
  • All other python libraries should be inside a virtualenv.
  • Running source venv/bin/activate will activate the correct python to run InstaPy.
    And to exit an activated virtualenv run deactivate.
  • Now, copy & paste the quickstart.py python code below and run your first InstaPy script.
    Remember to run it with python from the virtualenv, so from venv/bin/python.
  • To make sure which python is used, run which python which would tell you the active version of python.

⁠InstaPy Available Features

⁠Commenting
# default enabled=False, ~ every 4th image will be commented on

session.set_do_comment(enabled=True, percentage=25)
session.set_comments(['Awesome', 'Really Cool', 'I like your stuff'])

# you can also set comments for specific media types (Photo / Video)

session.set_comments(['Nice shot!'], media='Photo')
session.set_comments(['Great Video!'], media='Video')

# and you can add the username of the poster to the comment by using

session.set_comments(['Nice shot! @{}'], media='Photo')
⁠Following
# default enabled=False, follows ~ 10% of the users from the images, times=1
# (only follows a user once (if unfollowed again))

session.set_do_follow(enabled=True, percentage=10, times=2)
⁠Following by a list
⁠This will follow each account from a list of instagram nicknames
follow_by_list(followlist=['samantha3', 'larry_ok'], times=1, sleep_delay=600, interact=False)

only follows a user once (if unfollowed again) would be useful for the precise targeting
sleep_delay is used to define break time after some good following (averagely ~10 follows)
For example, if one needs to get followbacks from followers of a chosen account/group of accounts.

accs = ['therock','natgeo']
session.follow_by_list(accs, times=1, sleep_delay=600, interact=False)
  • You can also interact with the followed users by enabling interact=True which will use the configuration of set_user_interact setting:
session.set_user_interact(amount=4,
				 percentage=50,
                  randomize=True,
                   media='Photo')
session.follow_by_list(followlist=['samantha3', 'larry_ok'], times=2, sleep_delay=600, interact=True)
⁠Follow someone else's followers
# Follows the followers of each given user
# The usernames can be either a list or a string
# The amount is for each account, in this case 30 users will be followed
# If randomize is false it will pick in a top-down fashion

session.follow_user_followers(['friend1', 'friend2', 'friend3'], amount=10, randomize=False)

# default sleep_delay=600 (10min) for every 10 user following, in this case
# sleep for 60 seconds

session.follow_user_followers(['friend1', 'friend2', 'friend3'], amount=10, randomize=False, sleep_delay=60)

Note: simulation⁠ takes place while running this feature.

⁠Follow users that someone else is following
# Follows the people that a given users are following
# The usernames can be either a list or a string
# The amount is for each account, in this case 30 users will be followed
# If randomize is false it will pick in a top-down fashion

session.follow_user_following(['friend1', 'friend2', 'friend3'], amount=10, randomize=False)

# default sleep_delay=600 (10min) for every 10 user following, in this case
# sleep for 60 seconds

session.follow_user_following(['friend1', 'friend2', 'friend3'], amount=10, randomize=False, sleep_delay=60)

Note: simulation⁠ takes place while running this feature.

⁠Follow someone else's followers/following
# For 50% of the 30 newly followed, move to their profile
# and randomly choose 5 pictures to be liked.
# Take into account the other set options like the comment rate
# and the filtering for inappropriate words or users

session.set_user_interact(amount=5, randomize=True, percentage=50, media='Photo')
session.follow_user_followers(['friend1', 'friend2', 'friend3'], amount=10, randomize=False, interact=True)
⁠Follow by Tags
# Follow user based on hashtags (without liking the image)

session.follow_by_tags(['tag1', 'tag2'], amount=10)
⁠Follow the likers of photos of users
⁠This will follow the people those liked photos of given list of users
session.follow_likers(['user1' , 'user2'], photos_grab_amount = 2, follow_likers_per_photo = 3, randomize=True, sleep_delay=600, interact=False)

in this case 2 random photos from each given user will be analyzed and 3 people who liked them will be followed, so 6 follows in total
The usernames can be any list
The photos_grab_amount is how many photos will I grat from users profile and analyze who liked it
The follow_likers_per_photo is how many people to follow per each photo
randomize=False will take photos from newes, true will take random from first 12
sleep_delay is used to define break time after some good following (averagely ~10 follows)

  • You can also interact with the followed users by enabling interact=True which will use the configuration of set_user_interact setting:
session.set_user_interact(amount=2,
				 percentage=70,
                  randomize=True,
                   media='Photo')
session.follow_likers(['user1' , 'user2'], photos_grab_amount = 2, follow_likers_per_photo = 3, randomize=True, sleep_delay=600, interact=True)
⁠Follow the commenters of photos of users
⁠This will follow the people those commented on photos of given list of users
session.follow_commenters(['user1', 'user2', 'user3'], amount=100, daysold=365, max_pic = 100, sleep_delay=600, interact=False)

in this case (max 100 newest photos & maximum 365 days old) from each given user will be analyzed and 100 people who commented the most will be followed
The usernames can be any list
The amount is how many people to follow
The daysold will only take commenters from photos no older than daysold days
The max_pic will limit number of photos to analyze
sleep_delay is used to define break time after some good following (averagely ~10 follows)

  • You can also interact with the followed users by enabling interact=True which will use the configuration of set_user_interact setting:
session.set_user_interact(amount=3,
				 percentage=32,
                  randomize=True,
                   media='Video')
session.follow_commenters(['user1', 'user2', 'user3'], amount=100, daysold=365, max_pic = 100, sleep_delay=600, interact=True)
⁠Interact with specific users
# Interact with specific users
# set_do_like, set_do_comment, set_do_follow are applicable

session.set_do_follow(enabled=False, percentage=50)
session.set_comments(["Cool", "Super!"])
session.set_do_comment(enabled=True, percentage=80)
session.set_do_like(True, percentage=70)
session.interact_by_users(['user1', 'user2', 'user3'], amount=5, randomize=True, media='Photo')
⁠Interact with specific users' tagged posts
# Interact with specific users' tagged posts
# set_do_like, set_do_comment, set_do_follow are applicable

session.set_do_follow(enabled=False, percentage=50)
session.set_comments(["Cool", "Super!"])
session.set_do_comment(enabled=True, percentage=80)
session.set_do_like(True, percentage=70)
session.interact_by_users_tagged_posts(['user1', 'user2', 'user3'], amount=5, randomize=True, media='Photo')
⁠Interact with users that someone else is following
# Interact with the people that a given user is following
# set_do_comment, set_do_follow and set_do_like are applicable

session.set_user_interact(amount=5, randomize=True, percentage=50, media='Photo')
session.set_do_follow(enabled=False, percentage=70)
session.set_do_like

Tag summary

Content type

Image

Digest

Size

412.2 MB

Last updated

over 7 years ago

docker pull 360allround/quickstart