Steal Instagram followers – Part 2

As we saw in the previous article, we now have a list of users, including their name and their Instagram profile URL.

For this 2nd step, we will use this list to interact with them, in order to encourage them to subscribe to our Instagram page. This is the most delicate operation of this method because it is the likelihood of flagging or even banning our accounts high. We will come back to this after the demonstration.

The “First interaction with relevant Instagram accounts” script

The script will use the text file previously generated using the “List relevant Instagram accounts” script.

  • It will consult each profile thanks to the URLs collected, and follow those accounts.
  • If the account is private or if it is public but without any posts, it will only follow the account.
  • If the account is public with posts, they will follow the account but also watch their posts, and like some of them.

This will make those Instagram users interested in your account. If someone unknown starts liking your posts you may check who it is.

After 6 followed accounts, the script will go to the “explore” section of Instagram for 2 minutes and browse the posts. This action allows you to avoid any flags or bans from Instagram, by reproducing an activity without many interactions, but which is closer to the activity of a normal person than a simple pause. Then, it will continue by following another 6 accounts.

Let’s see the code

Selenium makes a request to the URL of the profile we collected. Thanks to Kameleo Instagram won’t realize that this is an automated browser. It first checks if the account is a public account but without a post. If so, it tracks it and writes it to a text file. Otherwise, it tries to check if the account is private, and follows the same process.

If the 2 previous conditions have not been satisfied, it will check if the account is still valid. It may be that when you collected the data, the account was valid but, in the meantime, it has been deleted, banned, or otherwise. In this case, it will simply delete the account in the text file. If this condition is not met, then the account must be a public account with posts. It will then follow the account, browse his photos, and will randomly like some of the posts it visits.

The emulate_browsing function is a simple function, which goes to the “explore” section of Instagram, and acts randomly according to 4 types of actions.

  1. The first is to scroll down a random number of times.
  2. The second allows you to move the mouse randomly on the page.
  3. The third is a null action, the script is paused.
  4. The fourth selects a post, stays there for a while and has a 1 in 10 chance of liking it. This function is an infinite loop, so as long as it is not stopped, it will continue its action.

The script also includes other small functions, such as write_realistic allowing one to write in a realistic way on Instagram. There is also the like_pic function which will like Instagram photos.

Limitations

This script performs the most sensitive actions, such as interacting directly with other users, over a long period and a large number of times. Instagram has implemented several mechanisms to counter this. They take into account the number of people followed according to a certain time, the nature of the actions, the movements of your mouse, etc. The script is configured to follow 6 people, then simulate for 2 minutes a standard use of Instagram, such as browsing photos, and liking some content. These parameters are for information only and may change from one time to another, or from one user to another.

If Instagram detects your activity, the people you follow may not be counted as your followers, and in the worst case, your account may be banned. It is therefore advisable to slow down the script and add a standard navigation moment between several follows. So the script will imitate real human actions.

Notes

In this script, we didn’t use any proxy, as the script is interacting with your own Instagram account. If you want to run this script with several accounts you manage but on the same machine, we suggest you to use Bright Data residential proxies. Note that Bright Data has a No KYC mode now as well. This will enable you to use their residential proxy network, and visit instagram.com without filling any KYC form. See our integration guide on how to use Kameleo with Bright Data.

See it in action

We have a short video about how the script works.

Download the script

This python project is published on GitHub as “Instagram follower stealer”. Please see the “Part 2” folder.

Please note that as the HTML structure of the Instagram website changes over time, this script may need a little maintenance as the CSS selectors may also change over time.

Let’s see the next part of this article.

Kameleo Team

Our team consists of IT security experts, professional developers, and privacy enthusiasts who always searching better ways for browser fingerprint protection and developing innovative tools for browser automation and web scraping.