0

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()
nathan
  • 1
  • 1
  • What do you mean when you say you were not able to get the rest of the info? Which fields? What happens when you run your code and what did you expect to happen instead? Any errors? See [ask]. – Robert Jan 10 '23 at 21:44
  • yes, i believe i am missing part of the code. Instagrapi has functions to output user info from username or user info from user id and i believe i am using it wrong but not sure what is wrong exactly. – nathan Jan 11 '23 at 07:21

0 Answers0