Java 中的 Twitter 流 API 带有空格的轨道? [英] Twitter streaming API in Java with tracks that have spaces?

查看:40
本文介绍了Java 中的 Twitter 流 API 带有空格的轨道?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用于连接 Twitter 流 API 的两个 Java 库是 twitter4jtweetstream4j.

Two Java libraries to connect to the Twitter streaming API are twitter4j and tweetstream4j.

Twitter 流 API 允许 "tracks" with space:

The Twitter streaming API allows "tracks" with spaces:

逗号分隔的关键字和短语是逻辑 OR,短语是逻辑 AND.短语中的单词由空格分隔.如果任何短语匹配,则推文匹配.如果推文中存在所有单词,则短语匹配.(例如,推特"是 AND 推特,the,twitter"是 OR 推特.

Comma separated keywords and phrases are logical ORs, phrases are logical ANDs. Words within phrases are delimited by spaces. A tweet matches if any phrase matches. A phrase matches if all of the words are present in the tweet. (e.g. ‘the twitter’ is the AND twitter, and ‘the,twitter’ is the OR twitter.).

但是,尝试在 twitter4j 中使用带有空格的轨道会导致 错误(401 未经授权).当使用带有空格的轨道时,tweetstream4j 也会抛出 401.

However, trying to use tracks with spaces in twitter4j causes an error (401 unauthorized). tweetstream4j also throws a 401 when using tracks with spaces.

有没有人使用 Java 库连接到 Twitter 流 API 并使用带空格的轨道?哪个库和版本?

Has anyone used a Java library to connect to the Twitter streaming API and used tracks with spaces? Which library and version?

推荐答案

Yusuke 声称已解决此问题 适用于 twitter4j 2.1.7.

Yusuke claims to have fixed this for twitter4j 2.1.7.

这篇关于Java 中的 Twitter 流 API 带有空格的轨道?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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