-2

我正在使用网站上的这个代码示例来搜索库中的特定短语。

Twitter twitter = TwitterFactory.getSingleton();
Query query = new Query("source:twitter4j yusukey");
QueryResult result = twitter.search(query);
for (Status status : result.getTweets()) {
    System.out.println("@" + status.getUser().getScreenName() + ":" + status.getText());
}

但是,我似乎得到了一个 Twitter 异常:

JSONObject["coordinates"] not a string.
Relevant discussions can be found on the Internet at:
http://www.google.co.jp/search?q=8c005e6e or
http://www.google.co.jp/search?q=c45cf3de
TwitterException{exceptionCode=[8c005e6e-c45cf3de 8c005e6e-c45cf3d6], statusCode=-1, message=null, code=-1, retryAfter=-1, rateLimitStatus=null, version=3.0.0}
at twitter4j.internal.json.z_T4JInternalJSONImplFactory.createGeoLocation(z_T4JInternalJSONImplFactory.java:96)
at twitter4j.internal.json.StatusJSONImpl.init(StatusJSONImpl.java:110)
at twitter4j.internal.json.StatusJSONImpl.<init>(StatusJSONImpl.java:76)
at twitter4j.internal.json.QueryResultJSONImpl.<init>(QueryResultJSONImpl.java:87)
at twitter4j.internal.json.z_T4JInternalJSONImplFactory.createQueryResult(z_T4JInternalJSONImplFactory.java:155)
at twitter4j.TwitterImpl.search(TwitterImpl.java:260)
at GrammarChecker.checkStatuses(GrammarChecker.java:70)
at GrammarChecker$1.actionPerformed(GrammarChecker.java:42)
at java.awt.Button.processActionEvent(Unknown Source)
at java.awt.Button.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

指示的行号指向调用“twitter.search(query)”。

有没有人有任何想法?

4

1 回答 1

0

我似乎已经通过更新库解决了这个问题——我之前运行的是 3.0。应该在最新版本(当前为 3.0.3)上工作。

于 2013-07-04T02:52:19.553 回答