Jack McLaughlin
Jack McLaughlin

Reputation: 305

Get total likes and comments from Instagram's API in JavaScript

I am currently displaying a range of stats of my Instagram account using their API. I'd like to know how to get the total number of likes and the total number of comments made to this account. Iconosquare (previously Statigram) provides in-depth statistics to your Instagram account - I'd like to take a similar approach to display the two stats in a div. Any support is greatly appreciated.

Upvotes: 2

Views: 5040

Answers (1)

krisrak
krisrak

Reputation: 12952

There is no API to get like and comment count for all photos by a user, you can get total likes and comments for each photo, so you will have to loop through all the photos from a user and then then add the total likes and comments.

https://api.instagram.com/v1/users/{USER_ID}/media/recent/?client_id=YOUR-CLIENT_ID 

This API will give photos from a user with pagination, add all likes and comments from photos.

Upvotes: 2

Related Questions