Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twython: Filtering more than one track.

Tags:

python

twitter

I am trying to download all tweets within some co-ordinate.

Code used:

stream.statuses.filter(track='Football',locations='22,70,24,74')

How can I pass more than one track such that It will download all tweets which contains one more tracks?

For example: 'Football' or 'game' or 'sport'.

like image 822
user2912166 Avatar asked May 25 '26 21:05

user2912166


1 Answers

From the Twitter API, seems like you can achieve this quite easily.

You can separate it by spaces, to obtain tweets with both tracks:

stream.statuses.filter(track='Football game',locations='22,70,24,74')

Or by commas, to obtain tweets with either track:

stream.statuses.filter(track='Football, game',locations='22,70,24,74')

I think twython only passes the values of track, so this should work fine.

Hope this helps!

like image 86
aIKid Avatar answered May 28 '26 09:05

aIKid