Reputation: 570
I have Python code that looks like the following:
stream.filter(follow=[twitter_id], track=[hashtag_to_track], threaded=True)
I need it to follow a certain user (myself) and get Tweets live containing a certain hashtag. twitter_id
is a string that contains the numerical user ID of a user and hashtag_to_track
is a string that contains the hashtag to track. However, this code is not working. When I include both items in the filter it is getting all Tweets including the hashtag not just specific Tweets from the user. How can I restrict this to get only the Tweets from the user? Thank you!
Upvotes: 0
Views: 428
Reputation: 5157
The track, follow, and locations fields should be considered to be combined with an OR operator.
track=foo&follow=1234
returns Tweets matching "foo" OR created by user 1234.
From the the Twitter API documentation for the POST statuses/filter endpoint that Stream.filter
uses.
You'll have to manually filter it yourself if you want to filter by both user and keyword.
Upvotes: 2