Using Open Source Software to Build Your Instagram Followers

I stumbled across InstaPy last week and have been eager to get some time to give it a go. Simply put, it’s an Instagram Like, Comment and Follow Automation Script. Reading through TimG’s post was kind-a inspiring. Through his script, he’s managed to get 2,500+ real followers on Instagram in 4 months, for only ~$5 p/month on hosting fees.

Needless to say, I wanted to see how well it could work for a side project of mine.

Ashamedly, I spent about 1.5hrs fumbling my way through getting it working — primarily because I had no Python experience at all. Eventually I got it up and running, so here’s a guide to help you.

1. Setup a Server

  • Spin up for a $10 DigitalOcean droplet — select One Click Apps > Docker
    - Important — Chrome (a dependency of InstaPy) didn’t like running on anything less than 2GB ram
    - This literally takes about 1-2mins with DigitalOcean!
    - Make sure you add your computer’s SSH key, so that you don’t need a username/password
  • SSH into your new box, via
  • Issue the following commands to get the server ready:
# Check for any server updates before we start
sudo apt-get update
# Install docker-compose in case it's not there
apt install docker-compose
# Install unzip, so we can unzip .zip packages
apt install unzip

2. Download InstaPy

cd ~/ && wget https://github.com/InstaPy/instapy-docker/archive/master.zip
unzip master.zip

3. Configure your Automation

# Update docker_quickstart.py with our own config
cd instapy-docker-master/docker-compose/
cp docker_quickstart.py.example docker_quickstart.py
nano docker_quickstart.py --softwrap

Read through the InstaPy docs to see what’s possible, but here’s a default for you to get started:

from instapy import InstaPy
from instapy.util import smart_run
# Write your automation here
# Stuck ? Look at the github page or the examples in the examples folder
insta_username = ''
insta_password = ''
dont_like = ['bad', 'terrible', 'hot', 'girl']
ignore_words = ['bad', 'terrible', 'horrible', 'hate']
friend_list = []
tag_list = ['blog', 'blogger', 'marketing', 'bloggerlife', 'bloggergirl', 'bloggerstyle', 'fashionista', 'bloggerlove', 'fashionblogger', 'blogging']
comments = ['🔥', '👍', '🤯']
# If you want to enter your Instagram Credentials directly just enter
# username=<your-username-here> and password=<your-password> into InstaPy
# e.g like so InstaPy(username="instagram", password="test1234")
bot = InstaPy(username=insta_username, password=insta_password, headless_browser=True)
with smart_run(bot):
bot.set_relationship_bounds(enabled=True,
potency_ratio=-1.21,
delimit_by_numbers=True,
max_following=5555,
min_followers=45,
min_following=45)
bot.set_do_comment(True, percentage=10)
bot.set_comments(comments)
bot.set_do_follow(enabled=True, percentage=50, times=2)
bot.set_dont_unfollow_active_users(enabled=True, posts=5)
bot.unfollow_users(amount=60, instapy_followed_enabled=True, instapy_followed_param="nonfollowers", style="FIFO", unfollow_after=90*60*60, sleep_delay=501)
bot.set_dont_include(friend_list)
bot.set_dont_like(dont_like)
bot.set_ignore_if_contains(ignore_words)
bot.like_by_tags(tag_list, amount=100)
bot.end()

4. Build and Start Docker

InstaPy uses Docker to house all of the dependencies for the project, meaning you don’t need to install each one, one by one. It’s as simple as running:

# Build InstaPy
docker-compose up -d --build && docker-compose down
# Start InstaPy
docker-compose up -d --build

You can see what it’s doing at any time, by viewing the server via the logs:

docker logs --tail 50 -f $(docker ps -a | grep instapy | cut -d " " -f 1)

5. Keep it running…non-stop

We’ll setup a cron to make sure it continues to run on a schedule. The following makes it start up every 12hrs.

# Setup a Cron to keep it running
EDITOR=nano crontab -e
# This will open the cron scripts
# Paste the following to the bottom of the file
0 */4 * * * cd ~/instapy-docker-master/docker-compose/ && /usr/bin/docker-compose down
1 */4 * * * cd ~/instapy-docker-master/docker-compose/ && /usr/bin/docker-compose up -d --build

That’s it. I’ll report back with any findings!

Extra

I also create a quick script to restart the container/script for convenience:

echo 'cd ~/instapy-docker-master/docker-compose/ && docker-compose down && docker-compose up -d --build && docker logs --tail 50 -f $(docker ps -a | grep instapy | cut -d " " -f 1)' > ~/restart.sh

Which you can run by simply typing:

bash ~/restart.sh

I lead, design & build digital goods @wearepvtl https://mcnam.ee

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store