这个 Facebook Graph JSON 调用有什么问题?

What's wrong with this Facebook Graph JSON call?

我正在尝试从 Facebook 上的相册(时间线)中提取照片并将它们插入到网站上的列表中,但它并没有抓取所有照片。

我正在使用 URL 中的 ?limit=xxx 来抓取第一页以外的内容,但它仍然无法正常工作。我应该使用分页 ID 吗?如果是,语法是什么?

$.getJSON('https://graph.facebook.com/616894958361877/photos?limit=500&callback=?',function(json){
    $.each(json.data,function(){
$('<li></li>').append('<span class="thumb" style="background: url(' + this.images[1].source + ') center center no-repeat; background-size: cover;"><a href=' + this.images[0].source + ' rel="gallery"></a></span>').appendTo('#timeline');
  });
});

这是有问题的 public Facebook 相册: https://goo.gl/ofrVjw

看起来上限是 100Check the graph explorer for that。限制 500 被 100 和 api return 分页详细信息覆盖。

同样在上面的代码片段中,在访问 images 数组时,可能会出现图像可能没有 images[1] 的情况,因此请尝试处理该问题。像这样

((photo.images[1]) ? photo.images[1].source: ''

在此演示中 http://jsbin.com/nalusu/1/ 您可以看到 api return 的 100 个结果。