我一直在使用一些Javascript来将我的Instagram Feed添加到我的网站,但最近它完全停止了,最近有什么改变了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);
});
答案 0 :(得分:2)
我今天早些时候遇到了同样的问题(使用PHP,而不是jQuery / JSON)。 我发现Instagram显然已经改变了。为了获得图像来源,我找到了:
'src': photo.images.standard_resolution
不再提供宽度和高度。
答案 1 :(得分: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."}