尝试使用twit NPM制作twitterbot。能够从机器人发推文但不能流式传输或检索提及。
以下是代码:
var restclient = require('node-restclient');
var Twit = require('twit');
var T = new Twit({
consumer_key: '[KEY]',
consumer_secret: '[SECRET]',
access_token: '[TOKEN]',
access_token_secret: '[TOKEN-SECRET]'
});
T.post('statuses/update', { status: 'Hello World! #firstTweet' }, function(err, data, response) {
console.log(err);
console.log(data);
}) // Working
T.get('statuses/mentions_timeline.json' , {count: 10}, function (data) {
console.log(data);
}); // Not working
var stream = T.stream('statuses/filter', { track: '@thefoodbot', language: 'en' })
stream.on('tweet', function (tweet) {
console.log(tweet);
}) // Not working
尝试检索提及时出现以下错误:
{ statusCode: 404, data: '{"errors":[{"message":"Sorry, that page does not exist","code":34}]}', twitterReply: '{"errors":[{"message":"Sorry, that page does not exist","code":34}]}' }
溪流根本没有回应。