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

# 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

3. Configure your Automation

# Update with our own config
cd instapy-docker-master/docker-compose/
nano --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_do_comment(True, percentage=10)
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.like_by_tags(tag_list, amount=100)

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!


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)' > ~/

Which you can run by simply typing:

bash ~/

I lead, design & build digital goods @wearepvtl

I lead, design & build digital goods @wearepvtl