简体   繁体   English

流媒体API Twitter - 获取公共Stram

[英]Streaming API Twitter - Get the public Stram

I'm using the hbc tools to build an app using streaming Api. 我正在使用hbc工具使用流式Api构建应用程序。 I just want to get the public streaming flow without any trackword or others filters. 我只想在没有任何跟踪词或其他过滤器的情况下获得公共流媒体流。 How can I manage to do that? 我怎么能设法做到这一点? Here is a sample of code I wrote: 这是我写的代码示例:

StatusesFilterEndpoint endpoint = new StatusesFilterEndpoint();
endpoint.trackTerms(Lists.newArrayList("#aTweet"));
Authentication auth = new OAuth1(consumerKey, consumerSecret, token, secret);
Client client = new ClientBuilder()
            .hosts(Constants.STREAM_HOST)
            .endpoint(endpoint)
            .authentication(auth)
            .processor(new StringDelimitedProcessor(queue))
            .build();
// Establish a connection
client.connect();

With this, I can just track a tweet but not all the public flow of tweet. 有了这个,我可以跟踪推文,但不是所有的公共流程的推文。 Thanks for your answers ^^ 谢谢你的回答^^

StatusesFilterEndpoint uses filter endpoint and it returns just matched tweets. StatusesFilterEndpoint使用过滤器端点,它只返回匹配的推文。 There is also StatusesSampleEndpoint implementation in hbc-core which returns small random sample from all tweets. hbc-core中还有StatusesSampleEndpoint实现,它从所有推文中返回小的随机样本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM