0

I have seen here, here and here.

I have a list of twitter users I want to stream live tweets for. But I am getting duplicate tweets. And the tweets are not live per se.

Here is the code:

users_to_follow = ['twitterid_1', 'twitterid_2', 'twitterid_3']

mystream = tweepy.Stream(self.auth, self.listener)
        try:
            mystream.filter(follow=users_to_follow)
        except:
            print("error!")
            mystream.disconnect()

It is bringing back the tweets but the same tweets are being duplicated. What am I doing wrong?

Cheers

Shery
  • 1,808
  • 5
  • 27
  • 51

1 Answers1

0

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.

Andy Piper
  • 11,422
  • 2
  • 26
  • 49
  • 1
    yes, i was getting their followers tweets as well...I created a work around... I am checking if the twitter id is equal to the user who tweets and only then save that... thanks for your help :) – Shery Jun 08 '20 at 19:50