List of Non Followers on Instagram who Interact on Your Posts

In this Post, We will See how to get list of non followers on instagram who have ever insteracted on your posts but haven’t followed you on instagram but have liked any of your post.

We will do this using Python Library instaloader. The Purpose of this Post is to perform different analysis on your account that can’t be directly acheived through instagram App. We can have a deeper look at our account through different scrapping techniques using Instaloader. and we can use those insights to grow our account. Once we get list of users who are interested in our content. We can perform marketing techniques on that audience to grow our business.

In this Post, We will first see how to get list of non followers who interact on your posts using python. And then we will see how to automate sending them messeges in DM, inviting them to like our page or buy our products.

Getting list of non Followers

First step is to install the required library, that is instaloader. Installation is very easy , we just have to run a simple pip command in our cmd( anaconda prompt in my case as I am using Jupyter notebook).

pip install instaloader

Once we are done with installation, We need to import module in our jupyter notebook python 3 file. and paste below code there.

import instaloader
L = instaloader.Instaloader()
# Login or load session, give your username and password
L.login('username', 'password')        # (login)
USER = "code_seekers" #username of the account on which we want to perform our scrapping
#we can perform this scrapping technique on any account that is public or at whome our account(whose credentials are give) has access.
#this loads the profile of user.
profile = instaloader.Profile.from_username(L.context, PROFILE)
#creating a list to save accounts who liked our posts

likes = set()
print("Fetching likes of all posts of profile {}.".format(profile.username))
#this iterates through all posts of given account and getch accounts who have liked posts and saves them in likes list.
#note: we can give a specific post link as well to perform scrapping and analysis from that post only.
#for this purpose, instaloader.Post.from_shortcode(L.context,shortcode) this method can be used.
for post in profile.get_posts():
    likes = likes | set(post.get_likes())

#after getting likes list, we need to get list of followers..
print("Fetching followers of profile {}.".format(profile.username))
followers = set(profile.get_followers())

#simply subtract likes from followers and we will get non followers who have liked our posts..
nonfollowers = likes - followers

#storing non followers list in text file so that we can perform further operations on it.
print("Storing Non Followers into file.")
with open("nonfollowers.txt", 'w') as f:
    for nf in nonfollowers:
        print(nf.username, file=f)

Above code will give us list of non followers on instagram account who ever liked our posts.

Now Next Step is to Automate Sending Them Messege to invite them to follow us or buy our Products.

For that purpose View this Post: Automate Sending Messeges on Instagram using Python

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *