Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get instagram followers list with python

This code that i have written gives me 1000 followers per 10 minute which is a slow process for getting 18 million follower list. I would like to have access to prada's follower list in shorter amount of time.thanks for your replies the slow process is instagram limitations fault. So give a way to get the follower list faster.

 # Get instance
import instaloader
L = instaloader.Instaloader()

# Login or load session
L.login(username, password)        # (login)


# Obtain profile metadata
profile = instaloader.Profile.from_username(L.context, "prada")

# Print list of followees



follow_list = []
count=0
for followee in profile.get_followers():
    follow_list.append(followee.username)
    file = open("prada_followers.txt","a+")
    file.write(follow_list[count])
    file.write("\n")
    file.close()
    print(follow_list[count])
    count=count+1
# (likewise with profile.get_followers())
like image 346
hemin saed Avatar asked Mar 20 '19 15:03

hemin saed


People also ask

How do I get a list of followers on instagram with Python?

Open a terminal or cmd again and run the bot using this command: python run.py . Enter the username of the person whose followers you want to scrape. Enter how many followers you want to scrape. And that's it.

How can I get a list of followers on instagram?

This first option is easy: just go to your profile on Instagram – the URL www.instagram.com/yourusername – and click on the “# followers” label up a the top. This will pop up a lightbox that will show you several pieces of information. The username of each person who follows you.

How do I export instagram followers to CSV?

Sign in instagram and open the extension. 2. Select or input the IG user you want to export, choose the export type then click 'GO'.


1 Answers

Main bottleneck may be pulling the data from instagram, but you can improve speed by opening and closing only once outside of the loop; also you don't really need the array:

file = open("prada_followers.txt","a+")
for followee in profile.get_followers():
    username = followee.username
    file.write(username + "\n")
    print(username)

file.close()
like image 50
AlejandroVD Avatar answered Oct 05 '22 01:10

AlejandroVD