问题
Currently, I am using the Twitter streaming API to get realtime tweets for certain keywords. However, I would like to skip tweets that are irrelevant before getting them.
With the Search API I can search for "hello -john" so I only get tweets that contain the word hello, but not John or I can search for "hello Maria OR Andrew" so I get only tweets that contain the word hello AND either Maria or Andrew.
With the Streaming API, I can only give keywords but is there a way I can use -john or things like OR in these keywords?
回答1:
Unfortunately, there's no way to exclude keywords via the streaming API. The docs only specify the ability to add keywords to the search but not exclude. You'll need to filter words out in your code.
来源:https://stackoverflow.com/questions/6465757/exclude-keywords-in-twitter-streaming-api