skip to Main Content

I am trying to create a twitter stream for accounts that I currently follow. Most of them are private. I was wondering if there was a way to create a twitter stream that catches tweets from private accounts?

Currently using Tweepy, but open to other APIs.

class listener(StreamListener):
    print("Running stream")
    def on_data(self, data):

        print("data")
        return(True)

    def on_error(self, status):

        print(status)

auth = OAuthHandler(ckey, csecret)

# Access to user's access key and access secret
auth.set_access_token(atoken, asecret)

# Calling api
api = API(auth)

twitterStream = Stream(auth, listener())
twitterStream.filter(follow=['x'])

2

Answers


  1. Have you checked out the documentation for data streaming in Tweepy. It seems to be close to what you want. As for those accounts tweets being private, if you follow them and they follow you then their tweets appear on your feed and with an authenticated account they should be available to your stream.

    Login or Signup to reply.
  2. No, there is not. The only way you could do this is via the Account Activity (webhook) API and if those private accounts consented to sign in and deliver events to your application. You cannot simply stream events from protected accounts.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search