我试图检索的tweets,其中包含像挂钟,墙纸,墙贴使用tweepy过滤器选项的话。我知道“space”的意思是AND和“,”的意思是OR。你知道吗
我提到的官方文件:https://dev.twitter.com/streaming/overview/request-parameters#track
在docs示例中,'twitter api,twitter streaming'
应该得到以下tweets。你知道吗
1. The Twitter API is awesome
2. The twitter streaming service is fast
3. Twitter has a streaming API
有没有办法把这两个操作数合并起来。你知道吗
例如:"twitter api,streaming"
应该检索上面所有的tweet。你知道吗
我试过这种方法
class StdOutListener(StreamListener):
def on_data(self, data):
print data
return True
def on_error(self, status):
print status
l = StdOutListener()
auth = OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
stream = Stream(auth, l)
stream.filter(track=['stream.filter(track=['twitter api,streaming'])'])
它只获取包含流媒体或twitterapi的tweet。但不是我想要的方式。你知道吗
您只需要
twitter OR api OR streaming
不带逗号。此方法将为您列出的所有3个。你知道吗现在,如果您想要twitter api或twitter流,那么请执行以下操作:
"twitter api" OR "twitter streaming"
。这将从列表中得到1和2,而不是3。你知道吗有关更多信息,请查看Query Operators
为了明确
and
和or
,and
就twitter而言不必明确指定,原因如下:请注意,这与使用
"watching now"
不同,后者意味着“观看”必须紧跟在“现在”之后。你知道吗但是,必须指定
or
:相关问题 更多 >
编程相关推荐