Instagram API: Retrieve IDs/names of friends who have liked the user's posted Instagram images

白昼怎懂夜的黑 提交于 2021-02-19 07:45:39

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!