Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get ALL likes for a given media-id

I am trying to iterate over the user ID of each like for a given {media_id}

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

is returning something like this (a data array of approx 300 likes)

{
    "data": [{
        "username": "jack",
        "first_name": "Jack",
        "last_name": "Dorsey",
        "type": "user",
        "id": "66"
    },
    {
        "username": "sammyjack",
        "first_name": "Sammy",
        "last_name": "Jack",
        "type": "user",
        "id": "29648"
    }]
}

The problem is that it does not return ALL the likes, or any pagination feature.

Is there any workaround to get ALL likes for a given {media_ID}?

like image 535
Hank Avatar asked Dec 20 '22 06:12

Hank


1 Answers

You're using the correct API endpoint to get media likes, however this endpoint has a limitation. It only returns a maximum of 100-120 likes per media with no pagination.

Unfortunately there is no workaround!

The same limitation applies for the comments endpoint.

like image 138
stacky Avatar answered Mar 27 '23 21:03

stacky