问题描述
限时送ChatGPT账号..我正在使用 Instagram API 获取关注特定帐户的人数,如下所示.
I'm using the Instagram API to get the number of people who follow a given account as follows.
$follow_info = file_get_contents('https://api.instagram/v1/users/477644454/followed-by?access_token=ACESS_TOKEN&count=-1');
$follow_info = @json_decode($follow_info, true);
这将返回一组 50 个结果.他们在数组中确实有一个 next_url
键,但是在处理成千上万的关注者时,继续转到下一页会很耗时.
This returns a set of 50 results. They do have a next_url
key in the array, but it becomes time consuming to keep on going to the next page of followers when dealing with tens of thousands.
我在 StackOverflow 上读到,将 count
参数设置为 -1
将返回整个集合.但是,好像没有……
I read on StackOverflow that setting the count
parameter to -1
would return the entire set. But, it doesn't seem to...
推荐答案
Instagram 限制在其 API 中为各种端点返回的结果数量,并且他们在没有警告的情况下任意更改这些限制,大概是为了处理服务器负载.
Instagram limits the number of results returned in their API for all sorts of endpoints, and they change these limits arbitrarily, without warning, presumably to handle server load.
存在几个类似的线程:
Instagram API 未完成计数参数 在 Instagram API 中显示 20 多张照片Instagram API:如何获取所有用户媒体?(也请参阅对答案的评论,-1
返回的结果少 1).Instagram API 的 350 个请求限制Instagram API:如何获取所有用户媒体?
Instagram API not fufilling count parameter
Displaying more than 20 photos in instagram API
Instagram API: How to get all user media? (see comments on answer too, -1
returns 1 less result).
350 Request Limit for Instagram API
Instagram API: How to get all user media?
简而言之,您将无法增加最大返回行数,并且您将卡在分页中.
In short, you won't be able to increase the maximum returned rows, and you'll be stuck paginating.
这篇关于使用 Instagram API 获取所有关注者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论