在Twitter Streaming API中排除关键字 [英] Exclude keywords in Twitter Streaming API

查看:76
本文介绍了在Twitter Streaming API中排除关键字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我正在使用Twitter流API来获取某些关键字的实时推文.但是,我想先忽略不相关的推文.

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.

使用Search API,我可以搜索"hello -john",所以我只会得到包含单词"hello"的推文,而不能搜索John,或者我可以搜索"hello Maria OR Andrew",因此,我只能获取包含单词的推文你好,玛丽亚或安德鲁.

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.

使用Streaming API,我只能提供关键字,但是我可以在这些关键字中使用-john或OR之类的方法吗?

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?

推荐答案

不幸的是,无法通过流API排除关键字. 文档仅指定向搜索添加关键字的能力,但不能排除.您需要将代码中的单词过滤掉.

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.

这篇关于在Twitter Streaming API中排除关键字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆