这是我第一次使用twitter4j我从github得到项目试图运行它来查看如何使用twitter4j的结果,当我运行Crawler类时我得到了这个
0 [Twitter Stream consumer-1[initializing]] INFO twitter4j.TwitterStreamImpl - Establishing
connection. 5617 [Twitter Stream consumer-1[Establishing connection]] INFO
twitter4j.TwitterStreamImpl - 401:Authentication credentials (https://dev.twitter.com/pages
/auth) were missing or incorrect. Ensure that you have set valid consumer key/secret, access
token/secret, and the system clock is in sync.
我想从Ensure that you have set valid consumer key/secret
我应该改变twitter4j.proprieties的礼节!!我是对还是错?我怎样才能改变它的礼节呢?
有人可以帮忙吗?
答案 0 :(得分:-2)
尝试this链接中给出的以下选项来设置密钥:
调试=真 oauth.consumerKey = ********************* oauth.consumerSecret = ****************************************** oauth.accessToken = ********************************************** **** oauth.accessTokenSecret = ******************************************
ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(真)
.setOAuthConsumerKey( “*********************”)
.setOAuthConsumerSecret( “*************”) .setOAuthAccessToken(“************ ****“) .setOAuthAccessTokenSecret( “*************”); TwitterFactory tf = new TwitterFactory(cb.build()); Twitter twitter = tf.getInstance();
$ java -Dtwitter4j.debug = true -Dtwitter4j.oauth.consumerKey = ********************* -Dtwitter4j.oauth.consumerSecret = ****************************************** -Dtwitter4j.oauth.accessToken = ************* ******* -Dtwitter4j.oauth.accessTokenSecret = ****************************************** -cp twitter4j-core-4.0.2.jar:yourApp.jar yourpackage.Main
$ export twitter4j.debug = true $ export twitter4j.oauth.consumerKey = ********************* $ export twitter4j.oauth.consumerSecret = ****************************************** $ export twitter4j.oauth.accessToken = *************** ****** $ export twitter4j.oauth.accessTokenSecret = ****************************************** $ java -cp twitter4j-core-4.0.2.jar:yourApp.jar yourpackage.Main