1
I am working on a project that consists of collecting the tweets posted here in Brazil, I am using the Twitter API and the tweepy library of Python, I can take the terms that are in trending Topics and do a search for them and collect their tweets, but I wanted to do it randomly and in real time. I can make collections in real time with the StreamListener
but I don’t know how I do it to collect the tweets randomly.
my code:
class MyStreamListener(tweepy.StreamListener):
def on_status(self, status):
print(status.text)
myStreamListener = MyStreamListener()
myStream = tweepy.Stream(auth = autenticacao, listener=myStreamListener)
myStream.filter(track=['python'])
in the myStream.filter
I specify what I want to search for, but I don’t want to do a specific search I want to collect the tweets that are being posted here in Brazil in real time. If anyone knows any way to do that it would help me a lot.
Vlw friend, you saved me here!
– Renato Lopo
You have to draw around the map of Brazil that below it generates some coordinates.
– lmonferrari
I’m getting through
– Renato Lopo
Do you know if it is possible to pass two locations?
– Renato Lopo
Possibly yes, in the form of two different lists, for example:
location = [[-73.5,-33.0,-34.7,4.9], [-76.5,-32.0,-32.7,2.9]]
– lmonferrari
I get it, thank you!
– Renato Lopo
You’re welcome Renato! Hug!
– lmonferrari