Advertisement
juliomzt

Untitled

Mar 18th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.65 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package com.gd.twitter4j;
  7.  
  8. import java.util.List;
  9. import twitter4j.Relationship;
  10. import twitter4j.Status;
  11. import twitter4j.Twitter;
  12. import twitter4j.TwitterException;
  13. import twitter4j.TwitterFactory;
  14. import twitter4j.auth.OAuthAuthorization;
  15. import twitter4j.conf.ConfigurationBuilder;
  16.  
  17. /**
  18.  *
  19.  * @author imstu
  20.  */
  21. public class Main {
  22.  
  23.     private static final String CONSUMER_KEY = "xx";
  24.     private static final String CONSUMER_SECRET = "xx";    
  25.     private static final String ACCESS_TOKEN = "xx";
  26.     private static final String ACCESS_TOKEN_SECRET = "xx";
  27.      
  28.     public static void main(String[] args) throws TwitterException {
  29.         ConfigurationBuilder builder = new ConfigurationBuilder();
  30.         builder.setOAuthAccessToken(ACCESS_TOKEN);
  31.         builder.setOAuthAccessTokenSecret(ACCESS_TOKEN_SECRET);
  32.         builder.setOAuthConsumerKey(CONSUMER_KEY);
  33.         builder.setOAuthConsumerSecret(CONSUMER_SECRET);
  34.         OAuthAuthorization auth = new OAuthAuthorization(builder.build());
  35.         Twitter twitter = new TwitterFactory().getInstance(auth);
  36.         for (int i =0; i <= 45; i++) {
  37.         List<Status> statuses = twitter.getUserTimeline();
  38.         System.out.println(statuses.size());
  39.         for (Status status : statuses) {            
  40.             System.out.println(status.getId()+" @" + status.getUser().getScreenName() + " - " + status.getText());
  41.             twitter.destroyStatus(status.getId());
  42.         }
  43.         }
  44.     }
  45.    
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement