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