【问题标题】:Instagram images have stopped pulling throughInstagram 图片已停止通过
【发布时间】:2013-04-26 21:03:44
【问题描述】:

我一直在使用一些 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);
});

【问题讨论】:

    标签: javascript html instagram


    【解决方案1】:

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

    'src': photo.images.standard_resolution
    

    不再提供宽度和高度。

    【讨论】:

    • 现在,Instagram 提要恢复到以前的结构。
    • 我仍然无法将我的费用拉入网页。还有其他想法吗?
    【解决方案2】:

    您似乎超出了每小时的请求数限制。我访问此链接并收到以下错误: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."}
    

    【讨论】:

    • 我根本无法访问提要,所以我怎么会超过每小时的请求数?你能看到任何其他可能导致它突然停止的问题吗
    • 您从何处获得此访问令牌?这是你的,还是你在别的地方弄到的?
    • 认为我可能在其他地方得到了它,我在哪里可以获得自己的访问令牌?
    • 如果您从网络上的其他任何地方获得此信息,我并不感到惊讶,因为它超出了任何限制,因为其他人可能也这样做了。要自己获得一个,您似乎需要转到开发者页面并设置一个帐户:instagram.com/developer
    • 我注册了一个新客户,然后我使用此 URL api.instagram.com/oauth/authorize/… 替换客户 ID 并用分配给我的内容重定向 Url 然后我被重定向到显示代码的页面网址,但从那里我不知道 id 从哪里获得我的访问令牌。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-26
    • 1970-01-01
    • 2017-09-09
    • 1970-01-01
    • 1970-01-01
    • 2019-09-01
    相关资源
    最近更新 更多