0
我目前正在使用一些JavaScript,它从我搜索的hashtag中抽取6个最新图像。我想整理6张最新的图片,而不使用哈希标签来搜索特定的图片。在没有使用标签的情况下在Instagram上拉最近的Feed
什么我需要添加到这个代码从一个用户,而不是哈希标签
$(function() {
var cmdURL, embedImage, onPhotoLoaded, param, tag_name, userid,
param = {
access_token: 'xxxxxx', // feel free to change it with your own access token
count: 6 // the total number of images
},
用户id =“11941870”, 标签=“”拉6张最近的图片//你的用户ID。您可以通过查看您的某张照片来找到这一张照片。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);
});
我已经更新上面的代码,以证明我在用户ID代码已经添加,但似乎没有任何希望通过在所有现在拉。有什么建议么 ? – Gezzamondo
您的代码仍在使用标签api网址。它应该是cmdURL ='ht tps:// api。 instagram.com/v1/users/'+userId+'/media/recent?callback='?; – Jkike