0

我正在尝试使实时标签订阅正常工作,但似乎实时更新仅在一分钟内更新。这是我的代码,你能指出我缺少什么吗?

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();                      
        }
    });                 
}
});   
});
4

1 回答 1

0

很确定你没有使用正确的方法——你想使用 Instagram.subscriptions.subscribe 来获取实时提要,而不是 tags.subscribe

于 2013-12-23T10:37:52.417 回答