Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Followers Pagination #403

Open
808arc opened this issue Dec 16, 2022 · 2 comments
Open

Followers Pagination #403

808arc opened this issue Dec 16, 2022 · 2 comments

Comments

@808arc
Copy link

808arc commented Dec 16, 2022

Hi guys! im new to coding and I was reading documentation and build this script to get list of followers
but I keep getting errors. Can some one please explain me what im doing wrong and why?

from instagram_private_api import Client, ClientCompatPatch

user_name = '***'
password = '***'

api = Client(user_name, password)



from random import randint
from time import sleep



user_id = api.username_info('target')['user']['pk']

# Create a list of followers' usernames
usernames = []



next_max_id = followers.get('next_max_id')

while next_max_id:
    delay = randint(20,40)
    print("Sleep " + str(delay) + "s")
    sleep(delay)
    # Get a list of the user's followers
    followers = api.user_followers(user_id, rank_token=api.generate_uuid(),)
    next_max_id = followers.get('next_max_id')

    for follower in followers['users']:
        usernames.append(follower['username'])
    


# Print the list of followers' usernames
print(len(usernames))
print(usernames)


@808arc
Copy link
Author

808arc commented Dec 22, 2022

Hi! Im going test this code asap! Kindly thank you for showing me how it can work in that way <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@808arc and others