Skip to main content

Increase your Instagram followers with a simple Python bot

I can’t say this was a surprise to me, that there were bots in Instagram… It just made me want to build one myself!

And that is why we’re here, so let’s get to it! I came up with a simple bot in Python, while I was messing around with Selenium and trying to figure out some project to use it. Simply put, Selenium is like a browser you can interact with very easily in Python.

Just what the world needed! Another Instagram bot…

After giving this project some thought, my objective was to increase my audience with relevant people. I want to get followers that actually want to follow me and see more of my work. It’s very easy to come across weird content in the most used hashtags, so I’ve planed this bot to lookup specific hashtags and interact with the photos there. This way, I can be very specific about what kind of interests I want my audience to have. For instance, I really like long exposures, so I can target people who use that hashtag and build an audience around this kind of content. Simple and efficient!

This is not a “get 1000 followers in 24 hours” kind of bot!

So what kind of numbers are we talking about?

I ran the bot a few times in a few different hashtags like “travelblogger”, “travelgram”, “lisbon”, “dronephotography”. In the course of three days I went from 380 to 800 followers. Lots of likes, comments and even some organic growth (people that followed me but were not followed by the bot).

But I don’t want to follow so many people in the process…

The most efficient way to get followers in Instagram (apart from posting great photos!) is to follow people. And this bot worked really well for me because I don’t care if I follow 2000 people to get 400 followers.

Why will you share your code?!

That’s the debate I had with myself. Even though I truly believe in giving back to the community (I still learn a lot from it too!), there are several paid platforms that do more or less the same as this project. Some are shady, some are used by celebrities. The possibility of starting a similar platform myself, is not off the table yet, so why make the code available?

I learn a lot more when I type the code myself, instead of copy/pasting scripts. I hope you feel the same way!

The script isn’t as sophisticated as it could be, and I know there’s lots of room to improve it. But hey… it works! I have other projects I want to add to my portfolio, so my time to develop it further is rather limited. Nevertheless, I will try to update this article if I dig deeper.

This is the last subtitle!

You’ll need Python (I’m using Python 3.7), Selenium, a browser (in my case I’ll be using Chrome) and… obviously, an Instagram account! Quick overview regarding what the bot will do:

  • For every hashtag in the hashtag list, it will open the page and click the first picture to open it
  • It will then like, follow, comment and move to the next picture, in a 200 iterations loop (number can be adjusted)
  • Saves a list with all the users you followed using the bot

And that’s it!

After a few hours without checking the phone, these were the numbers I was getting. I definitely did not expect it to do so well! In about 4 days since I’ve started testing it, I had around 500 new followers, which means I have doubled my audience in a matter of days. I’m curious to see how many of these new followers I will lose in the next days, to see if the growth can be sustainable. I also had a lot more “likes” in my latest photos, but I guess that’s even more expected than the follow backs.

I didn’t get the screenshot at the exact start of the bot, but you get the idea!


Popular posts from this blog

CRUD operations using Flask and SQLAlchemy

Every database-related application has to deal with CRUD operations. It is used to store and retrieve data from the database. The CRUD operations are,
CreateInsertUpdateDeleteSQLAlchemy provides us a method to perform the CRUD operations. We can see this with the help of the book table. The book model looks like this.

Inserting the recordsNew records can be inserted by following these three steps. They are Create the python objectAdd it to the sessionCommit the session ExampleData can be inserted into the book model by the following commands.

Deleting the records
Deleting the records is very similar to adding the records. Instead of using the session.add(), we will use session.delete(), and commit the changes.

Querying the database
Flask-SQLAlchemy provides a query attribute on model class. Querying refers to the action of retrieving data from the database. For example, we may need only the people living in a particular city or from a particular age group. For these purposes querying come…

Python program to count the number of occurrences of a letter in a word or in a sentence

Suppose if we want to count the number of occurrences of a letter in a word or in a sentence, we can use the count function from python.

This is the sample code. I am assigning a string to the variable called text. Then i am counting the number of 'e' in the text.

This code produces an output of 8.

Python String count() 

The string count() method returns the number of occurrences of a substring in the given string. In simple words, count() method searches the substring in the given string and returns how many times the substring is present in it.

 It also takes optional parameters start and end to specify the starting and ending positions in the string respectively.

 The syntax of count() method is: 

string.count(substring, start=..., end=...)By providing the start value the function searches for the substring only after the start index.

If an end value is given the function searches until the end of this index.


In this example there is a list consisting of different words. I wi…

Map function in python [map()]

Map function is a good alternative for the “for loops” in python. Sometimes we do not want our code to look clumsy because of all the for loops we have used. In this case the “map()” in python comes to the rescue.
What are map functions?

map() function returns a map object(which is an iterator) of the results after applying the given function to each item of a given iterable (list, tuple etc.)


map(fun, iter)

map() Parameter
function - map() passes each item of the iterable to this function.iterable iterable which is to be mapped
You can pass more than one iterable to the map() function.

The map() function applies a given to function to each item of an iterable and returns a list of the results.
The returned value from map() (map object) then can be passed to functions like list() (to create a list), set() (to create a set) and so on.

Map function with a list

In this example there is a single list called numbers and a function square. The map function iterates the list one by one, passes t…