javascript Instagram API 未完成计数参数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11995555/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Instagram API not fufilling count parameter
提问by himynameismarvin
The project can be viewed at http://watchsuburbia.com
该项目可以在http://watchsuburbia.com查看
I have a pagination gallery of Instagram images with a specific tag, but it is not loading more than 64 photos right now (was loading approximately 70 previously). If you go to page 5, you can see it just stops abruptly. I have the countparameter in my URL and it's set to something high like 250 just to test, lowing it to something like 100 doesn't make a difference. There are currently211 photos with the specific tag.
我有一个带有特定标签的 Instagram 图片分页库,但它现在加载的照片不超过 64 张(之前加载了大约 70 张)。如果您转到第 5 页,您会看到它突然停止。我的URL 中有count参数,它设置为 250 之类的高值只是为了进行测试,将其降低到 100 之类的值并没有什么区别。有目前211张照片与特定标签。
The url I'm using is
我使用的网址是
https://api.instagram.com/v1/tags/watchsuburbia/media/recent?client_id=[CLIENTID]&access_token=[ACCESSTOKEN]&count=300
*Obviously with real clientid and access_token*
*显然有真实的clientid和access_token*
UPDATEThe limit has gotten even shorter again and is capping at 4 pages of photos now. It seems to get progressively lower every day which is extremely odd.
更新限制再次变得更短,现在上限为 4 页照片。它似乎每天都在逐渐降低,这非常奇怪。
回答by Charlotte
What Instagram does is finds most recent X number of images you asked for (in this case, anything tagged #watchsuburbia) Then it checks if those are private, removes those and returns that subset. So if 3 videos out of that X are private, it'll actually return X-3 images.
Instagram 所做的是找到您要求的最新 X 张图像(在这种情况下,任何标记为 #watchsuburbia 的图像)然后它检查这些图像是否是私有的,删除它们并返回该子集。因此,如果该 X 中的 3 个视频是私有的,它实际上会返回 X-3 图像。
What the co-founder suggestsis that you look for more than you need as a buffer and filter it yourself.
什么是联合创始人建议是,你找比你更需要作为缓冲区,并将自己的过滤。
Side note: everyone in those videos sounds so Canadian.
旁注:这些视频中的每个人听起来都很加拿大。
回答by Jochem Schulenklopper
See generic information on Instagram API endpoints. It mentions the presence of a count
parameter on the API requests... but does not list a specific maximum number. Perhaps Instagram is throttling the number of media in the result set -- hence the variation in result set size -- and they use the supplied count
as a maximum value. Perhaps the actual maximum count depends per endpoint / type of object.
查看Instagram API 端点的一般信息。它提到count
API 请求中存在一个参数……但没有列出具体的最大数量。也许 Instagram 正在限制结果集中的媒体数量——因此结果集大小的变化——他们使用提供的count
作为最大值。也许实际的最大计数取决于每个端点/对象类型。
What you should do is use the numbers returned in the pagination
hash in the result, and step through the results. The hash mentions a new value for the next maximum id (e.g., next_max_tag_id
for tags or next_max_id
for images) of the next page. Via that, you can retrieve subsequent result sets until no next results remain.
您应该做的是pagination
在结果中使用散列中返回的数字,并逐步遍历结果。散列提及下一页的下一个最大id(例如,next_max_tag_id
标签或next_max_id
图像)的新值。通过它,您可以检索后续结果集,直到没有下一个结果为止。
回答by Alex Pliutau
Sorry for surrian link, but I had the same problem and solved it with pagination.
很抱歉 surrian 链接,但我遇到了同样的问题并通过分页解决了它。
回答by fliim
I dont think that the count parameters works in this endpoint (not yet?). And the difference of media is because the count include private media I guess. You can see that in http://statigr.am/. their is the same difference.
我不认为计数参数在这个端点中起作用(还没有?)。媒体的不同之处在于,我猜这个数字包括私人媒体。您可以在http://statigr.am/ 中看到。他们是相同的区别。