I am using instaload librabry
source code is here
# 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, "pink_sfsu")
# Print list of followees
for followee in profile.get_followers():
print(followee)
I am trying to retrieve the number of followers of the followers of the account. I successfully get the follower of the account but can manage to know its number of follower. I am reading the source code. Because I assume that instaloader already do similar things to get all the followers of a page. Therefore I try to extend this but don't succeed.
Try something like this:
# Print all followers with their followers count
for follower in profile.get_followers():
print('{} has {} followers'.format(follower.username, follower.followers))
If you wanted to get the followers of your followers, according to the documentation, this should do it.
followers_of_followers = []
for followee in profile.get_followers():
followers_of_followers.extend(followee.get_followers())
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.