本文介绍了使用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.

我在计算器上读到设置计数参数 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为各种端点返回结果的数量,他们随意更改这些限制,没有警告,presumably来处理服务器负载。

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.

几个类似的线程存在:



  • 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来获取所有的追随者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 21:22