Advertisement
Guest User

Untitled

a guest
Apr 26th, 2012
496
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. public static void main(String[] args){
  2. ConfigurationBuilder cb = new ConfigurationBuilder();
  3. cb.setDebugEnabled(true)
  4. .setOAuthConsumerKey("*********************")
  5. .setOAuthConsumerSecret("******************************************")
  6. .setOAuthAccessToken("**************************************************")
  7. .setOAuthAccessTokenSecret("******************************************");
  8. //TwitterFactory tf = new TwitterFactory(cb.build());
  9. //Twitter twitter = tf.getInstance();
  10.  
  11.  
  12. TwitterStream twitterStream = new TwitterStreamFactory(cb.build()).getInstance();
  13. StatusListener listener = new StatusListener() {
  14. public void onStatus(Status status) {
  15. System.out.println("@" + status.getUser().getScreenName() + " - " + status.getText());
  16. }
  17.  
  18. public void onDeletionNotice(StatusDeletionNotice statusDeletionNotice) {
  19. System.out.println("Got a status deletion notice id:" + statusDeletionNotice.getStatusId());
  20. }
  21.  
  22. public void onTrackLimitationNotice(int numberOfLimitedStatuses) {
  23. System.out.println("Got track limitation notice:" + numberOfLimitedStatuses);
  24. }
  25.  
  26. public void onScrubGeo(long userId, long upToStatusId) {
  27. System.out.println("Got scrub_geo event userId:" + userId + " upToStatusId:" + upToStatusId);
  28. }
  29.  
  30. public void onException(Exception ex) {
  31. ex.printStackTrace();
  32. }
  33. };
  34. twitterStream.addListener(listener);
  35. twitterStream.sample();
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement