instagraminstagram-apiendpoints

How to retrieve comments from a media in instagram?


I'm working on a project which aims to analyse instagram users' posts. I have a list of users and for each of them I have to crawl the recent media with the number of likes, comments and the text of comments. By using the recent media endpoint I've achieved some user media (of my user, using the access_token associated to my account). The result only gives the number of comments per media, but not the text. So I selected some media_id from this output and tryied to retrieve the comments associated to the media. But the result is ever

{"meta": {"code": 200}, "data": []}

The endpoint url that I use is

https://api.instagram.com/v1/media/{media-id}/comments?access_token=ACCESS-TOKEN

the access_token is generated with public_content, follower_list and basic scopes.

My app is in a sandbox, and I am the only one user of the sandbox. Any suggestion? thanks in advance


Solution

  • You have to be in live mode and have public_content permission to get comments.

    sandbox mode will only give you and your sandbox user's info in API response, if you or your sandbox user have commented on a media then that will only show in response, once u go live mode, all comments will be in response.

    Also API will only give you maximum of 150 latest comments for any media, not all.