1 year ago

#75784

test-img

Secretcode

How to stream who a user starts following tweepy

So I am trying to create a function that basically is able to use the stream.listener function in tweepy to send a message when a user follows a new person. So basically the function would be in pseudocode of course

if user follow new:
    print(¨User has followed{user}¨)

This is the code I have right now I am able to stream new tweets that come out of a user using the documentation but I couldn't find anything to stream new followers and such. Any help would be appreciated!!! Thanks!

class MyStreamListener(tweepy.StreamListener):
  def on_status(self, status):
    print(status.text)
    myStreamListener = MyStreamListener()
    myStream = tweepy.Stream(auth = api.auth, listener=myStreamListener)
    myStream.filter(follow=["(Id private)"])

python

twitter

stream

bots

tweepy

0 Answers

Your Answer

Accepted video resources