在不使用主题标签的情况下在 Instagram 上获取最新的提要
Pulling in most recent feed on instagram without using hashtag
我目前正在使用一些 javascript 从我搜索的主题标签中提取 6 张最新图像。我想在不使用主题标签搜索特定图像的情况下整体提取 6 张最新图像。
我需要在此代码中添加什么才能从用户而不是主题标签中提取 6 张最新图像
$(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
},
userId = '11941870',
tag = '', //你的用户id。你可以通过查看你的一张照片找到这个
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);
});
看InstagramApi有这个电话
https://api.instagram.com/v1/users/<user_id>/media/recent
这将 return 用户的最新照片。
我想你可以在这里查看它是如何工作的https://instagram.com/developer/api-console/
我目前正在使用一些 javascript 从我搜索的主题标签中提取 6 张最新图像。我想在不使用主题标签搜索特定图像的情况下整体提取 6 张最新图像。
我需要在此代码中添加什么才能从用户而不是主题标签中提取 6 张最新图像
$(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
},
userId = '11941870', tag = '', //你的用户id。你可以通过查看你的一张照片找到这个 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);
});
看InstagramApi有这个电话
https://api.instagram.com/v1/users/<user_id>/media/recent
这将 return 用户的最新照片。
我想你可以在这里查看它是如何工作的https://instagram.com/developer/api-console/