我有一个任务,我需要使用 twitter4j 按地理位置获取推文,有关 OAuth 和 token 的所有内容我都正确执行,但是当我尝试创建查询时,方法 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));
如果您需要更多代码,请告诉我哪一部分,我将更新帖子
最佳答案
首先尝试将其分解并从那里开始工作:
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);
关于java - twitter4j 通过地理位置获取推文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26530621/