Javascript Instagram api返回后链接

Javascript Instagram api返回后链接,javascript,instagram,instagram-api,Javascript,Instagram,Instagram Api,我正在用Instagram图片制作图库,现在我想链接我的图库,我想当用户点击图片时,它应该在Instagram帖子上重定向他。所以现在我需要从instagram api获取链接。 现在我只有照片,我是这样得到的: jQuery.ajax({ url: 'https://api.instagram.com/v1/users/' + userid + '/media/recent', dataType: 'jsonp', type: 'GET', data: {acc

我正在用Instagram图片制作图库,现在我想链接我的图库,我想当用户点击图片时,它应该在Instagram帖子上重定向他。所以现在我需要从instagram api获取链接。 现在我只有照片,我是这样得到的:

jQuery.ajax({
    url: 'https://api.instagram.com/v1/users/' + userid + '/media/recent',
    dataType: 'jsonp',
    type: 'GET',
    data: {access_token: token, count: num_photos},
    success: function(data){ ........
那么有人能帮我如何获取post URL吗

从中,您应该使用链接参数来获取每张照片的链接。此代码应位于成功(数据)函数中。使用/users/self/media/recent端点,可能会这样称呼它:

[...]
success: function(data){
    for (i = 0; i < data.length; i++){ 
        var photoURL = data[i].images.standard_resolution.url;
        var photoLink = data[i].link;
        var username = data[i].user.username;

        var html = "<a href='" + photoLink + "' target='_blank'>";
        html += "    <img src='" + photoURL + "' alt='" + username + "'>";
        html += "</a>";

        // here you should append this html code to some container box
        document.getElementById("myContainer").innerHTML += html;
    }
}
照片区的用户:

"users_in_photo": [{
        "user": {
            "username": "kevin",
            "full_name": "Kevin S",
            "id": "3",
            "profile_picture": "..."
        },
        "position": {
            "x": 0.315,
            "y": 0.9111
        }
    }],
图像部分:

"images": {
        "low_resolution": {
            "url": "http://distillery.s3.amazonaws.com/media/2010/07/16/4de37e03aa4b4372843a7eb33fa41cad_6.jpg",
            "width": 306,
            "height": 306
        },
        "thumbnail": {
            "url": "http://distillery.s3.amazonaws.com/media/2010/07/16/4de37e03aa4b4372843a7eb33fa41cad_5.jpg",
            "width": 150,
            "height": 150
        },
        "standard_resolution": {
            "url": "http://distillery.s3.amazonaws.com/media/2010/07/16/4de37e03aa4b4372843a7eb33fa41cad_7.jpg",
            "width": 612,
            "height": 612
        }
    },

祝你好运

你是在寻找图片的URL还是帖子的URL?@TariqB。文章的url。Sry my mistake数据对象中的link参数应该是文章的URL。请试试。@TariqB。你能帮我了解一下语法吗?数据:{access_token:token,count:num_photos,URL}?您必须通过Oauth获取授权代码和token,并在该请求中使用它。
"images": {
        "low_resolution": {
            "url": "http://distillery.s3.amazonaws.com/media/2010/07/16/4de37e03aa4b4372843a7eb33fa41cad_6.jpg",
            "width": 306,
            "height": 306
        },
        "thumbnail": {
            "url": "http://distillery.s3.amazonaws.com/media/2010/07/16/4de37e03aa4b4372843a7eb33fa41cad_5.jpg",
            "width": 150,
            "height": 150
        },
        "standard_resolution": {
            "url": "http://distillery.s3.amazonaws.com/media/2010/07/16/4de37e03aa4b4372843a7eb33fa41cad_7.jpg",
            "width": 612,
            "height": 612
        }
    },