How to Scrape User Data and usernames with InstaGrapi

691 views Asked by At

I am trying to use instagrapi to scrape user data such as "is_private" "is_verified" "username"/ I was able to grab the username but not the rest of the info. can anyone help me please.

from instagrapi import Client

cl = Client()
cl.login("user", "pass")

def scrapeusers():
    target = input("Please input the target you want to scrape from: ")
    userid = cl.user_id_from_username(target)
    amt = int(input("Please input how many followers you would like to scrape: "))
    scraped = cl.user_followers(user_id=userid, amount=amt)
    User = cl.user_info_by_username(username=str)
    for userid in scraped.items():
        with open("users.txt", "w") as outfile:
            for User in User.items():
                outfile.write(cl.user_info_by_username([0]).dict() + "\n")
scrapeusers()
0

There are 0 answers