Python Script for detecting and blocking Instagram Follower Bots
Instagram new algorithm favors user engagement over other factors for presenting your contents to your followers1
This means if your followers engagement with your contents are low (i.e. less than 10% of your followers like your posts), Instagram ML algorithms identify you as a spammer and prevent your content from getting enough user reach and impression
Follower Bots engagement rate is zero because they usually lack the the abillity to like your posts or post a comment so they signal instagram to mark you as spammer.
By removing follower bots, your content will reach much higher engagment rates over time.
I have implemented two methods for removing follower bots:
In Bot directory, find_and_block.py automatically finds follower bots and blocks them.
In Assistant directory, there are 2 scripts.
find.py finds follower bots, then saves them to Data/BlackList.csv and Data/WhiteList.csv
block.py then reads Data files and block users
You can check algorithms output in Data csv files.
You can checkout algorithm precision in the following table. Results are dervied from running scripts on My personal Instagram Account
Algorithm | Precision |
---|---|
Unsupervised | 73% |
Supervised | 86% |
* In Unsupervised script there is an stochastic module which identify subs as bots based on follower to following ratio so precision is affected by this module.
First change configuration.json file. If you want to save data files to default path, leave whitelist_path and blacklist_path unchanged.
Then select one of Bot (for Supervised) or Assistent (for Unsupervised) method.
I included random sleep in script exectution to meet instagram limitations for subsequent api requests from a single node.
Alter this sleeping times with caution.
Also in Supervised mode, you can find fake followers without your personal account. Just create some fake instagram account (Which is ironic 🤦♂️) and use this account.
1: How Instagram’s algorithm works, https://techcrunch.com/2018/06/01/how-instagram-feed-works/