Closed DusterTheFirst closed 7 years ago
Hi,
The documentation allow you to pass a follow
param.
The stream will then contain :
- Tweets created by the user.
- Tweets which are retweeted by the user.
- Replies to any Tweet created by the user.
- Retweets of any Tweet created by the user.
- Manual replies, created without pressing a reply button (e.g. “@twitterapi I agree”).
The stream will not contain:
- Tweets mentioning the user (e.g. “Hello @twitterapi!”).
- Manual Retweets created without pressing a Retweet button (e.g. “RT @twitterapi The API is great”).
- Tweets by protected users.
I think you can try this :
let user_id = 3657556095; // @dusterthesecond
Twitter.stream('statuses/filter', { follow: user_id }, (stream) => {
stream.on('data', (tweet) => {
console.log(tweet.text);
});
stream.on('error', (error) => {
console.log(error);
});
});
If you only want :
- Tweets created by the user.
- Tweets which are retweeted by the user.
Replies to any Tweet created by the user.Retweets of any Tweet created by the user.- Manual replies, created without pressing a reply button (e.g. “@twitterapi I agree”).
let user_id = 3657556095; // @dusterthesecond
Twitter.stream('statuses/filter', { follow: user_id }, (stream) => {
stream.on('data', (tweet) => {
if(tweet.user.id === user_id) { // Only tweets from the user id
console.log(tweet.text);
}
});
stream.on('error', (error) => {
console.log(error);
});
});
can I make it follow multiple twitters?
EDIT: yes, seperate by commas
how would I use the streaming API to detect when a user posts,
I have
but that only tracks tweets that mention
@dusterthesecond