How to Collect Real-Time Tweets

Twitter API - how to get real time tweets by user

You should be able to pass the follow keyword like this:

stream.filter(follow=['user_id'])

It receives a list of user IDs.

From the API docs, this should return:

  • 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”).

It doesn't return:

  • 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.

Note
You can specify both track and follow values and it will result in tweets with the input keyword or tweets created by the input user.

Twitter API - Listen to a user's tweets in real-time

From https://dev.twitter.com/streaming/reference/post/statuses/filter

follow

A comma-separated list of user IDs, indicating the users whose Tweets should be delivered on the stream.

So, if you POST John,Paul,George,Ringo you will get a stream which includes:

  • Tweets created by the user.
  • Tweets which are retweeted by the user.
  • Replies to the user.
  • Retweets of the user.

Get live tweets from a specific user list... getting duplicates tweepy python

Per the Twitter documentation on the follow parameter:

follow

A comma-separated list of user IDs, indicating the users whose Tweets
should be delivered on the stream. Following protected users is not
supported. For each user specified, the stream will 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.

When you say that "the same Tweets are being duplicated", do you mean that you're seeing the same Tweet IDs multiple times?

You also mentioned that the "Tweets are not live" but it is not clear what you mean by this.



Related Topics



Leave a reply



Submit