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.
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.
pip install instapy
That's it π«β
Now all you need is a quickstart script to start InstaPy π₯³
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β .
# 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β .
pip install instapy -U
pip install instapy==0.1.1
pip uninstall instapy
Talk about automating your Instagramβ | Talk about doing Open-Source workβ |Β Listen to the "Talk Python to me"-Episodeβ
β
β
Help build InstaPy!
Check out this short guide on how to start contributing!β .
Official InstaPy Guide on Udemyβ
Installation on DigitalOcean Serverβ
How to Ubuntu (64-Bit)β Β Β Β Β Β Β
How to RaspberryPiβ Β Β Β Β Β Β
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.
-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,
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β π
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 .
-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..
python setup.py install
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 .
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;
source venv/bin/activate will activate the correct python to run InstaPy. To exit an activated venv run deactivate.which python which will tell you the active version of python.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,
root (e.g., with sudo).source venv/bin/activate will activate the correct python to run InstaPy.deactivate.which python which would tell you the active version of python.# 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')
# 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)
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)
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)
# 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.
# 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.
# 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 user based on hashtags (without liking the image)
session.follow_by_tags(['tag1', 'tag2'], amount=10)
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)
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)
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)
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
# 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
# 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 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
Content type
Image
Digest
Size
412.2 MB
Last updated
over 7 years ago
docker pull 360allround/quickstart