0

我一直在使用一些 Javascript 将我的 Instagram 提要拉入我的网站,但最近它完全停止了拉动,最近 Instagram 发生了一些变化,这可能是导致这种情况的原因吗?

我做了谷歌搜索,看看某处是否有变化,但似乎找不到任何东西

这是我正在使用的代码

$(function() {
var cmdURL, embedImage, onPhotoLoaded, param, tag_name, userid,
param = {
access_token: '3794301.f59def8.e08bcd8b10614074882b2d1b787e2b6f', // feel free to change it with your own access token
count: 10 // the total number of images
},
tag = 'Gezzamondoportfolio', // your user id. you can find this one out by looking into one of your pictures uri
tag_name = '#photowall',
cmdURL = 'https://api.instagram.com/v1/tags/' + tag + '/media/recent?callback=?';

 embedImage = function(photo) {
var a, img;
img = $('<img/>').attr({
  //'src': photo.images.thumbnail.url,
  //'width': photo.images.thumbnail.width,
  //'height': photo.images.thumbnail.height
  'src': photo.images.standard_resolution.url,
  'width': photo.images.standard_resolution.width,
  'height': photo.images.standard_resolution.height
});
a = $('<a />').attr({
  'href': photo.images.standard_resolution.url,
  'target': '_blank',
  'class': 'pull-left'
}).append(img).appendTo(tag_name);
};

onPhotoLoaded = function(data) {
var photo, _i, _len, _ref, _results;
if (data.meta.code === 200 && data.data) {
  _ref = data.data;
  _results = [];
  for (_i = 0, _len = _ref.length; _i < _len; _i++) {
    photo = _ref[_i];
    _results.push(embedImage(photo));
  }
  return _results;
}
};
return $.getJSON(cmdURL, param, onPhotoLoaded);
});
4

2 回答 2

2

今天早些时候我遇到了同样的问题(使用 PHP,而不是 jQuery / JSON)。我发现,显然,Instagram 提要发生了变化。要获取图像源,我发现:

'src': photo.images.standard_resolution

不再提供宽度和高度。

于 2013-04-26T10:14:38.447 回答
0

您似乎超出了每小时请求的限制。我访问此链接并收到以下错误:https ://api.instagram.com/v1/tags/Gezzamondoportfolio/media/recent?callback=?&access_token=3794301.f59def8.e08bcd8b10614074882b2d1b787e2b6f

{"code": 420, "error_type": "OAuthRateLimitException", "error_message": "You have exceeded the maximum number of requests per hour. You have performed a total of 345 requests in the last hour. Our general maximum request limit is set at 30 requests per hour."}
于 2013-04-26T00:00:19.820 回答