问题
I would like to know how I can retrieve the list of people a user is following on Instagram. This is given that this particular user is someone that I follow. So I have access to his/her photos and his followers on the Instagram app.
How can I use the Instagram API to do this? Is this legal to do?
回答1:
You can use the following Instagram API Endpoint to get a list of people a user is following.
https://api.instagram.com/v1/users/{user-id}/follows?access_token=ACCESS-TOKEN
Here's the complete documentation for that endpoint. GET /users/user-id/follows
And here's a sample response from executing that endpoint.
Since this endpoint required a user-id
(and not user-name
), depending on how you've written your API client, you might have to make a call to the /users/search endpoint with a username, and then get the user-id from the response and pass it on to the above /users/user-id/follows
endpoint to get the list of followers.
IANAL, but considering it's documented in their API, and looking at the terms of use, I don't see how this wouldn't be legal to do.
回答2:
Shiva's answer doesn't apply anymore. The API call "/users/{user-id}/follows" is not supported by Instagram for some time (it was disabled in 2016).
For a while you were able to get only your own followers/followings with "/users/self/follows" endpoint, but Instagram disabled that feature in April 2018 (with the Cambridge Analytica issue). You can read about it here.
As far as I know (at this moment) there isn't a service available (official or unofficial) where you can get the followers/followings of a user (even your own).
回答3:
The REST API of Instagram has been discontinued. But you can use GraphQL to get the desired data. Here you can find an overview: https://developers.facebook.com/docs/instagram-api
回答4:
You can use Phantombuster. Instagram has set some rate limit, so you will have to use either multiple accounts or wait for 15 minutes for the next run.
来源:https://stackoverflow.com/questions/32407851/instagram-api-how-can-i-retrieve-the-list-of-people-a-user-is-following-on-ins