【问题标题】:Twitter4j API track and location filterTwitter4j API 跟踪和位置过滤器
【发布时间】:2014-10-20 06:25:09
【问题描述】:

我正在使用 Twitter4j API 来收集来自印度的推文。我正在应用过滤器来收集仅具有特定关键字的推文,但我正在从印度地区获取所有推文,没有特定的关键字。我的代码是

    FilterQuery filter = new FilterQuery();
    String keyword[]= {"flu"};

    double [][]location ={{68.1,8.06},{97.41,37.10}};

    filter.track(keyword);

    filter.locations(location);

    twitterstream.addListener(listener);

    twitterstream.filter(filter);

如何从印度获得将“流感”作为推文文本的一部分的推文。

【问题讨论】:

    标签: java twitter twitter4j


    【解决方案1】:

    之所以如此,是因为 twitter 过滤器参数一起应用的不是 AND,而是 OR。 在此处查看更多信息 - https://dev.twitter.com/streaming/overview/request-parameters

    twitter API 文档也这么说 -

    Bounding boxes do not act as filters for other filter parameters. For exampletrack=twitter&locations=-122.75,36.8,-121.75,37.8 would match any tweets containing the term Twitter(even non-geo tweets) OR coming from the San Francisco area.

    希望这会有所帮助。

    【讨论】:

    • 谢谢,我该如何解决我的问题,意味着从特定位置过滤特定关键字推文。
    • 也许您可以在位置上收集推文并提供您自己的过滤逻辑或收集关键字特定推文并确定地理分布。
    猜你喜欢
    • 1970-01-01
    • 2015-10-15
    • 2016-06-28
    • 1970-01-01
    • 2016-10-14
    • 2016-11-07
    • 1970-01-01
    • 1970-01-01
    • 2017-10-27
    相关资源
    最近更新 更多