List of usage examples for twitter4j.conf ConfigurationBuilder ConfigurationBuilder
ConfigurationBuilder
From source file:public_streaming.GeoStream.java
License:Apache License
public static void main(String[] args) throws Exception { Configuration configuration = new ConfigurationBuilder().setOAuthConsumerKey(CONSUMER_KEY) .setOAuthConsumerSecret(CONSUMER_SECRET).setOAuthAccessToken(ACCESS_TOKEN) .setOAuthAccessTokenSecret(ACCESS_TOKEN_SECRET).build(); TwitterStream twStream = new TwitterStreamFactory(configuration).getInstance(); twStream.addListener(new MyStatusListener()); // //w ww .ja va 2 s .c om FilterQuery filter = new FilterQuery(); double[][] locations = { { -180.0d, -90.0d }, { 180.0d, 90.0d } };//??(???????) filter.locations(locations); twStream.filter(filter); }
From source file:public_streaming.HashtagStream.java
License:Apache License
public static void main(String[] args) throws Exception { Configuration configuration = new ConfigurationBuilder().setOAuthConsumerKey(CONSUMER_KEY) .setOAuthConsumerSecret(CONSUMER_SECRET).setOAuthAccessToken(ACCESS_TOKEN) .setOAuthAccessTokenSecret(ACCESS_TOKEN_SECRET).build(); TwitterStream twStream = new TwitterStreamFactory(configuration).getInstance(); twStream.addListener(new MyStatusListener()); //set filter/*from w ww .jav a 2 s. c om*/ FilterQuery filter = new FilterQuery(); String[] track = { "#nhk" };//hashtag filter.track(track); twStream.filter(filter); }
From source file:public_streaming.KeywordStream.java
License:Apache License
public static void main(String[] args) throws Exception { Configuration configuration = new ConfigurationBuilder().setOAuthConsumerKey(CONSUMER_KEY) .setOAuthConsumerSecret(CONSUMER_SECRET).setOAuthAccessToken(ACCESS_TOKEN) .setOAuthAccessTokenSecret(ACCESS_TOKEN_SECRET).build(); TwitterStream twStream = new TwitterStreamFactory(configuration).getInstance(); twStream.addListener(new MyStatusListener()); // /* w ww . jav a 2 s. co m*/ FilterQuery filter = new FilterQuery(); String[] keywords = { "android", "iphone" };//?public_timeline? filter.track(keywords); twStream.filter(filter); }
From source file:public_streaming.OAuthStream.java
License:Apache License
public static void main(String[] args) throws Exception { Configuration configuration = new ConfigurationBuilder().setOAuthConsumerKey(CONSUMER_KEY) .setOAuthConsumerSecret(CONSUMER_SECRET).setOAuthAccessToken(ACCESS_TOKEN) .setOAuthAccessTokenSecret(ACCESS_TOKEN_SECRET).build(); TwitterStream twStream = new TwitterStreamFactory(configuration).getInstance(); twStream.addListener(new MyStatusListener()); twStream.user();//OAuth????public_timeline?? }
From source file:public_streaming.PublicStream.java
License:Apache License
public static void main(String[] args) throws Exception { Configuration configuration = new ConfigurationBuilder().setOAuthConsumerKey(CONSUMER_KEY) .setOAuthConsumerSecret(CONSUMER_SECRET).setOAuthAccessToken(ACCESS_TOKEN) .setOAuthAccessTokenSecret(ACCESS_TOKEN_SECRET).build(); TwitterStream twStream = new TwitterStreamFactory(configuration).getInstance(); twStream.addListener(new MyStatusListener()); twStream.sample();//public_timeline }
From source file:public_streaming.SampleStream.java
License:Apache License
public static void main(String[] args) { // ?//from w ww . j a v a 2s .co m Configuration configuration = new ConfigurationBuilder().setOAuthConsumerKey(CONSUMER_KEY) .setOAuthConsumerSecret(CONSUMER_SECRET).setOAuthAccessToken(ACCESS_TOKEN) .setOAuthAccessTokenSecret(ACCESS_TOKEN_SECRET).build(); // TwitterStream?? TwitterStream twitterStream = new TwitterStreamFactory(configuration).getInstance(); // Listener twitterStream.addListener(new Listener()); // ???????????? twitterStream.sample(); }
From source file:public_streaming.UserIDStream.java
License:Apache License
public static void main(String[] args) throws Exception { Configuration configuration = new ConfigurationBuilder().setOAuthConsumerKey(CONSUMER_KEY) .setOAuthConsumerSecret(CONSUMER_SECRET).setOAuthAccessToken(ACCESS_TOKEN) .setOAuthAccessTokenSecret(ACCESS_TOKEN_SECRET).build(); TwitterStream twStream = new TwitterStreamFactory(configuration).getInstance(); twStream.addListener(new MyStatusListener()); ///*from ww w. j av a 2 s . com*/ long[] follow = { 1598997848 };//anondroid3?id:1598997848 FilterQuery filter = new FilterQuery(follow);//?userID????? twStream.filter(filter); }
From source file:Recursos.Notificacion.java
/** * Constructor de la clase Notificacion//from ww w . j a v a 2s. co m * * inicializa todos los medios para hacer la coneccion de la cuenta del * twitter conn la aplicaccion */ public Notificacion() { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setOAuthConsumerKey("STFH7e9yQ8K7pIgs7oZSmsUB8"); cb.setOAuthConsumerSecret("6Uj5BMITSyd17UNFxTLi47k39KkOMuwIszCgXkc8AC3mNJEp3U"); cb.setOAuthAccessToken("133844036-u3qdbqgsxlSMeNWa5NzFrSCbnjAI7ExrRDHFrWw9"); cb.setOAuthAccessTokenSecret("5m7rBhbEQmll0bGtPGC3sqE3mo3emjmrjKrCBg26t9jhG"); twitter = new TwitterFactory(cb.build()).getInstance(); }
From source file:samples.TwitterSentiment.java
public static twitter4j.Twitter getTwitter() { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true).setOAuthConsumerKey("sB9TX9gJ9V4nB8Jh8ObKFd2FS") .setOAuthConsumerSecret("RPwx1Zb3DrWpqSA9g5V7GtXeidZES6xL5VnihnveSdREBA6Lgu") .setOAuthAccessToken("767789639843414021-3Svwm5jrJBXUkRLf0f2CAbKwSHLXH9B") .setOAuthAccessTokenSecret("KYUG7JbavSma9oaONPYU0ZIt1leAYFkPut75jBfWHrLTR"); TwitterFactory tf = new TwitterFactory(cb.build()); return tf.getInstance(); }
From source file:search.TwitterSearchBean.java
@PostConstruct public void init() { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true).setOAuthConsumerKey("tyyEHDfVKxsBqQWTeWgPkRhZd") .setOAuthConsumerSecret("94MPLfuaVzrWDo6RKc06MnuiJMz1yMkLvcO3wyqd6WtxIpSte0") .setOAuthAccessToken("169980309-qZqlDKT3XSdoki1WBmQFLHANx7QEyGxxm5tEN7gu") .setOAuthAccessTokenSecret("NjVrRzShxNkzyvUD5kn3KcvNvfQrelJXpzfljnSQeq9Ef"); TwitterFactory tf = new TwitterFactory(cb.build()); twitter = tf.getInstance();/*from ww w .ja v a2 s.c om*/ }