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

查看:34
本文介绍了排除 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.

使用搜索 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天全站免登陆