Open mkgerasimenko opened 5 years ago
The end_cusor is part of the return value you get from the getFollowings function. You could call it in a loop to get more then 50 followers. Be aware that you will get a 429 response if you call that function too many times.
var UserToFind;
var idsToLike = [];
var followersOfUser = [];
var end_cursor;
await client.getUserByUsername({ username: 'instagram' }).then(user =>{
UserToFind = user.id;
})
while(followersOfUser.length <= 500){
await client.getFollowers({ userId: UserToFind, first: 50, after: end_cursor }).then(followers => {
followers.data.forEach(function(value){
followersOfUser.push(value.id);
});
end_cursor = followers.page_info.end_cursor;
sleep(2000);
})
}
This will add 550 followers of the user instagram to an array. I'm sure there are cleaner ways to do this, but it does the job. The sleep() function helps to avoid an 429 response (you can use a timeout or whatever instead)
@EeeDotZee thanks for the solution, just encountered the same issue
Hello. Thank you for this project!
I have a problem with getting all followers/followings. I can catch 50 users(by default) from my account, but I need all.
This is my code:
I don't understand what I should do with after param. When I try to resolve end_cursor - I'm getting null :( For example:
nextPageToken is null.
Could you please provide me information about: how to get all followers/followings. Thank you!