【问题标题】:twitter4j get tweets by GeoLocationtwitter4j 通过 GeoLocation 获取推文
【发布时间】:2014-12-19 06:29:35
【问题描述】:

我有一个任务,我需要通过 Geo Location 使用 twitter4j 获取推文,关于 OAuth 和令牌的所有内容我都做对了,但是当我尝试创建一个查询时,方法 geoCode();
在编译过程中出现错误:

Error:(148, 60) java: cannot find symbol
  symbol:   method geoCode(twitter4j.GeoLocation,double,java.lang.String)
  location: class javax.management.Query

我不明白出了什么问题...
我的查询代码:

double lat = 59.4372155;
double lon = 24.7453688;
double res = 5;
String resUnit = "mi";
QueryResult result = twitter.search(new Query().geoCode(new GeoLocation(lat,lon),res, resUnit));

如果您需要更多代码,请告诉我哪个部分,我将更新帖子

【问题讨论】:

    标签: java twitter geolocation twitter4j tweets


    【解决方案1】:

    尝试先分解它并从那里开始工作:

    Query query = new Query().geoCode(new GeoLocation(lat,lon), res, resUnit); 
    query.count(11); //You can also set the number of tweets to return per page, up to a max of 100
    QueryResult result = twitter.search(query);
    

    【讨论】:

    • 非常感谢。有个问题,我报错了。我做了import javax.management.Query; 但需要import twitter4j.Query; 如果你没有给我你的代码,永远不会注意到我的注意力
    猜你喜欢
    • 1970-01-01
    • 2015-02-05
    • 2012-11-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-20
    • 2013-12-25
    相关资源
    最近更新 更多