【发布时间】:2014-06-26 22:09:38
【问题描述】:
我正在尝试获取包含“python”一词或我所在城市周围的推文
这是我的代码:
StatusListener listener = new MyStatusListener(twitter);
twitterStream.addListener(listener);
FilterQuery query = new FilterQuery();
String[] arr = { "python" };
double lat = 18.5203;
double lon = 73.8567;
double[][] locations = { { lat, lon } }; // for Pune city
query.track(arr);
query.locations(locations);
twitterStream.filter(query);
当我运行它时,我得到以下异常:
Returned by the Streaming API when one or more of the parameters are not suitable for the resource. The track parameter, for example, would throw this error if:
The track keyword is too long or too short.
The bounding box specified is invalid.
No predicates defined for filtered resource, for example, neither track nor follow parameter defined.
Follow userid cannot be read.
Location track items must be given as pairs of comma separated lat/longs: [Ljava.lang.String;@405ef8c2
[Thu Jun 26 19:06:58 GMT+05:30 2014]Parameter not accepted with the role. 406:Returned by the Search API when an invalid format is specified in the request.
Returned by the Streaming API when one or more of the parameters are not suitable for the resource. The track parameter, for example, would throw this error if:
The track keyword is too long or too short.
The bounding box specified is invalid.
No predicates defined for filtered resource, for example, neither track nor follow parameter defined.
Follow userid cannot be read.
Location track items must be given as pairs of comma separated lat/longs: [Ljava.lang.String;@405ef8c2
我成对收到相同的消息。如果我删除位置条件,则代码可以正常工作。我不确定这里有什么问题。有人可以帮忙吗?
【问题讨论】: