Reputation: 705
I am trying to get followers of a users API using PHP:-
$id= "xxxxxxx";
$access_token = "xxxxxx";
https://api.instagram.com/v1/users/$id/followed-by?access_token=$access_token&count=500
but this only returns with 100 records max.I need to get all the followers and export them in a CSV sheet.
Do I need to purchase any premium plan for this or anything else?
Upvotes: 4
Views: 1277
Reputation: 54
For large accounts, it's really difficult to get a list of all followers because you can only get them 100 followers at a time (as you're finding). Some automated services will get a list of all your followers by requesting them 100 at a time using multiple tokens (https://www.crowdbabble.com/download-all-instagram-followers/).
Upvotes: 0
Reputation: 1258
Read the instagram endpoint documentation
Each response sent by Instagram is wrapped on a Envelope, inside of that you will get a "pagination" url that you can use to get the next set of data.
Sometimes you just can't get enough. For this reason, we've provided a convenient way to access more data in any request for sequential data. Simply call the url in the next_url parameter and we'll respond with the next set of data.
The response for the followed_by
will return a json like this
{
"meta": {
"code": 200
},
"data": {
...
},
"pagination": {
"next_url": "url for next 100 responses",
"next_max_id": "13872296"
}
}
Just make another request for Response->pagination->next_url
Upvotes: 3
Reputation: 12952
You have use pagination.next_url
in API response to get more users.
If you just want to export any user's followers to csv
, you can use gramfeed to browse and download as csv.
For example here is followers for instagram account, when u scroll down you will have an option to download as .csv
, you can load all users and then download csv:
http://www.gramfeed.com/instagram#followers
Upvotes: 3