gpt4 book ai didi

java - 使用 Hbc Twitter Stream 而不指定任何跟踪术语

转载 作者:太空宇宙 更新时间:2023-11-04 07:06:22 32 4
gpt4 key购买 nike

我按照 HBC 中的快速入门进行操作我设法从 Twitter Stream 中获取了一些推文,其中指定了一些跟踪术语,代码如下:

/** Declare the host you want to connect to, the endpoint, and authentication (basic auth or oauth) */
Hosts hosebirdHosts = new HttpHosts(Constants.STREAM_HOST);
StreamingEndpoint endpoint = new StatusesFilterEndpoint();
// Optional: set up some followings and track terms
List<Long> followings = Lists.newArrayList(1234L, 566788L);
List<String> terms = Lists.newArrayList("twitter", "api");
endpoint.followings(followings);
endpoint.trackTerms(terms);

是否可以在不指定任何跟踪术语的情况下使用 Hbc 获取 twitter 流?我只是尝试删除“endpoint.trackTerms(terms);”行,但这样做不起作用。
帮我!谢谢!

最佳答案

它应该可以工作。我尝试了这个例子,并“跟随”自己,我收到了我在连接时发出的推文。

我怀疑您所关注的用户在您使用流时没有任何 Activity ,这就是您没有看到任何输出的原因 - 例如他们自己发推文或有人回复他们的推文等...

follow parameter文档概述了您将看到与关注的用户相关的 Activity 。

顺便说一句,当在过滤流上指定 followingstrackTerms 时,它实际上是在说让我从这些用户那里获取包含这些术语的推文。这就是为什么在指定 trackTerms 时您会看到输出。这也适用于附加的 locations 参数。

关于java - 使用 Hbc Twitter Stream 而不指定任何跟踪术语,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21316004/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com