我正在尝试使用 Instagram API 提取带有特定标签“watchsuburbia”的所有图像
它正在工作,但放得不完全,它只拉了 18 张照片,昨晚它只拉了 17 张......无论我如何设置我的循环。目前它应该拉取近 40 张照片(当前循环设置为仅 25 张)。
你可以在 http://himynameismarvin.com/instahelp 看到我正在尝试的内容
这是该函数(我删除了这篇文章的 API 信息,但将其包含在我的版本中并可以正常工作):
$(function() {
$.ajax({
type:"GET",
dataType:"jsonp",
cache:false,
url:"https://api.instagram.com/v1/tags/watchsuburbia/media/recent?client_id=[CLIENTID]&access_token=[ACCESSTOKEN]",
success:function(data){
for(var i=0; i<25; i++){
$("#pics").append("<div class='instaframe'><a target='_blank' href='"+data.data[i].link+"'><img src='"+data.data[i].images.standard_resolution.url+"' /></a></div>");
}
}
});
});
最佳答案
doc表示您可以传递 count
参数:
On views where pagination is present, we also support the "count" parameter. Simply set this to the number of items you'd like to receive. Note that the default values should be fine for most applications - but if you decide to increase this number there is a maximum value defined on each endpoint.
我在你的测试页中没有看到它,所以我尝试了一下。我可以始终获得 32 个元素,但不能再多了。我想这是 Instagram 方面的限制。
关于javascript - Instagram API 未加载所有图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11868891/