简体   繁体   中英

Twython: Filtering more than one track.

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'.

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM