传递'follow'参数时节点Twitter Streaming API 401

时间:2016-08-31 23:51:11

标签: node.js twitter twitter-streaming-api

我正在尝试传输其他用户的时间轴。

我已经设置了一个应用并获得了所有的信用,但我一直得到401。我做错了什么?

import Twitter from 'twitter';
import socketIO from 'socket.io';
import streamHandler from './../util/streamHandler';
import http from 'http';

export default function(app, serverConfig) {
  const server = http.createServer(app);
  const io = socketIO(server);


  const twit = new Twitter(serverConfig.twitter);


  twit.stream('statuses/filter', {
    follow: ['76633197'],
  }, (stream) => {

    stream.on('data', (tweet) => {
      console.log('data');
      console.log(tweet.text);
    });

    stream.on('error', (error) => {
      console.log(error);
    });
  });

  return server;
}

serverConfig.twitter看起来像:

{
  consumer_key: <redacted>,
  consumer_secret: <redacted>,
  access_token_key: <redacted>,
  access_token_secret: <redacted>
}

更新:这仅在我follow时发生。如果我将{track: 'javascript'}作为参数传递它可以正常工作......

0 个答案:

没有答案