I am doing electron application using react.js. I want to get live tweets from a user. But it seems I can't find a right way to do it.
I am using Twit library for node.js
So far I have done this :
import React, {Component} from 'react'
import Twit from 'twit'
class aaa extends Component {
constructor() {
super()
}
componentDidMount() {
const T = new Twit({
consumer_key: '...',
consumer_secret: '...',
access_token: '...-...',
access_token_secret: '...',
timeout_ms: 60*1000, // optional HTTP request timeout to apply to all requests.
})
let stream = T.stream('statuses/filter', { follow: '!username!' })
stream.on('tweet', function (tweet) {
console.log(tweet)
})
}
render() {
return(
<div>
</div>
)
}
}
export default aaa
This " follow: '!username!' " seems is not really a right way to do it. If I put here " track: 'word'" program works just fine. Any idea for solution?
Well I want to close this one. So I did as @Ratan Kumer suggest, found twitter ID on http://gettwitterid.com/ put follow: 'id'
here and works like a charm.
Thank you!