问题
We’re building an application where a user logs with Instagram API, accepts the permissions dialog and receives a personalised ‘dynamic story’ based on various data they allow us to read.
We’re hoping to display the user’s ‘top friends’ who have liked images that the user has posted onto their Instagram feed. Is there any way we could go about doing this?
Many thanks,
Matt
回答1:
Use this API to get all your followers:
https://api.instagram.com/v1/users/self/followed-by?access_token=ACCESS-TOKEN
Use this API to all your posts:
https://api.instagram.com/v1/users/self/media/recent/?access_token=ACCESS-TOKEN
For media_id's you get from the above API call, you can use this API to get the list users who have liked a media:
https://api.instagram.com/v1/media/{media-id}/likes?access_token=ACCESS-TOKEN
Compare the list of liker and list of followers to find the list of followers who have liked the media.
Note that Instagram only give the latest 120 likers in the API response, so if you photo gets more that 120 likes, you may not be able to efficiently get the data you want.
You also need basic
and public_content
API permissions to get the response from the APIs
来源:https://stackoverflow.com/questions/46326587/instagram-api-retrieve-ids-names-of-friends-who-have-liked-the-users-posted-in