使用 Instagram API 获取所有关注者

编程入门 行业动态 更新时间:2024-10-25 12:17:53
本文介绍了使用 Instagram API 获取所有关注者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送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:关键词]

本文发布于:2023-04-18 15:45:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/942639.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Instagram   API

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!