twitter4j 如何从 Twitter 流中仅获取带有位置数据的状态 [英] twitter4j how to get only statuses with location data from a twitter stream

查看:61
本文介绍了twitter4j 如何从 Twitter 流中仅获取带有位置数据的状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到了大量的onTrackLimitationNotice".我想通过仅搜索具有地理位置的状态来缩小我的谓词范围,但搜索所有地理位置?这能做到吗?我在 Processing 中编码,使用 twitter4j-2.2.6.

I'm getting high numbers of "onTrackLimitationNotice". I'd like to narrow my predicate by only searching for statuses with geo location, but all geo locations? Can this be done? Im coding in Processing, using twitter4j-2.2.6.

这是一个答案...感动.

it was an answer... moved.

推荐答案

我发现查询全局边界框的流,只返回具有地理位置的状态.所以这有效:

i found that querying the stream for a global bounding box, returns only status withs geo location. So this worked:

// cb is an instace of ConfigurationBuilder
TwitterStream twitter = new TwitterStreamFactory(cb.build()).getInstance();
FilterQuery filtro = new FilterQuery();    
double[][] bb= {{-180, -90}, {180, 90}};
filtro.locations(bb);
twitter.addListener(listener);
twitter.filter(filtro);

仅返回带有位置信息的推文.

returning only tweets with location info.

这篇关于twitter4j 如何从 Twitter 流中仅获取带有位置数据的状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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