node.js 模块 ntwitter 不工作
我尝试使用 ntwitter node.js 模块。我已阅读所有说明并键入示例代码,但它不起作用。代码如下:
var twit = new twitter({
consumer_key: 'XXXXXXXXXXXXXXXXXXX',
consumer_secret: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
access_token_key: 'https://api.twitter.com/oauth/request_token',
access_token_secret: 'https://api.twitter.com/oauth/access_token'
});
twit.stream('user', {track:'nodejs'},function(stream) {
console.log('stream==========================',stream);
stream.on('data', function (data) {
console.log('=============================================',data);
});
});
流的 console.log 显示如下内容:
stream========================== { buffer: '',
destroy: [Function],
_events: { _data: [Function: processTweet] } }
But console.log因为数据不显示任何内容。我被困住了,不知道该怎么办。任何人都可以帮忙。
I have tried to use ntwitter node.js module.I have read all the instructions and type the sample code,but it is not working.The code is as follows:
var twit = new twitter({
consumer_key: 'XXXXXXXXXXXXXXXXXXX',
consumer_secret: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
access_token_key: 'https://api.twitter.com/oauth/request_token',
access_token_secret: 'https://api.twitter.com/oauth/access_token'
});
twit.stream('user', {track:'nodejs'},function(stream) {
console.log('stream==========================',stream);
stream.on('data', function (data) {
console.log('=============================================',data);
});
});
The console.log for stream displays something like this:
stream========================== { buffer: '',
destroy: [Function],
_events: { _data: [Function: processTweet] } }
But console.log for data does not display anything.I am stuck and don't know what to do.Can anyone help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的 access_token_key 和 access_token_secret 值不正确。这些应该是生成的密钥,而不是 URL。
您的 Twitter 开发者页面上应该有一个用于创建您的访问令牌的按钮。单击它,然后使用此处提供的值。
Your access_token_key and access_token_secret values are incorrect. These are supposed be generated keys, not URLs.
There should be a button on your Twitter Developer page to Create Your Access Token. Click it, and use the values provided there instead.
我正在研究类似的问题。确保服务器上的时间设置正确,否则 oAuth 将失败
I'm looking into a similar issue. Make sure the time on your server is set correctly, otherwise oAuth will fail