使用 Instagram API 获取所有关注者 [英] Using the Instagram API to get ALL followers

查看:31
本文介绍了使用 Instagram API 获取所有关注者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 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.com/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 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆