Instagram实时标签订阅仅适用于一分钟 - node.js

时间:2013-11-13 03:12:00

标签: node.js instagram

我试图让实时标签订阅工作,但似乎实时更新只在一分钟内更新。这是我的代码,你能指出我错过的吗?

var Instagram = require('instagram-node-lib');

app.get('/GetInstagram', function(request, response){
// The GET callback for each subscription verification.
var params = url.parse(request.url, true).query;
response.send(params['hub.challenge'] || 'No hub.challenge present');
});

app.post('/GetInstagram', function (req, res) {

var tagName = 'love';

Instagram.set('client_id', 'clientID');
Instagram.set('client_secret', 'ClientSecret');

Instagram.tags.subscribe ({ object_id: tagName,access_token: null, client_id: 'clientid', client_secret: 'clientsecret', callback_url: 'http://myURL/GetInstagram', complete: function() 
{
    console.log('begin fetching');                          
    Instagram.tags.recent({ name: tagName,aspect: 'media', complete: function(data, pagination ) 
        {
            var chunk = { 'pagination': pagination, 'data': data };
            console.log (chunk.data.length);
            var len = 0;
            for (var i = 0, len = chunk.data.length; i < len; i++)
            {                           
                var url  = '"' + chunk.data[i].images.standard_resolution.url + '"';
                console.log('image from instagram image # ' + i + ' image URL' + chunk.data[i].images.standard_resolution.url );
            }                       
            res.end();                      
        }
    });                 
}
});   
});

1 个答案:

答案 0 :(得分:0)

非常确定你没有使用正确的方法 - 你想使用Instagram.subscriptions.subscribe进行实时反馈,而不是使用tags.subscribe