Example #1
0
 public static void main(String[] args) throws UnknownHostException {
   List<Long> laPerla2800UserIds =
       ListFileReader.readLongListFile(
           "/home/godzy/Dropbox/universita/tesi/laPerla/laPerla2800UsersIds.txt");
   TwitterCache twitterFacade = TwitterFacadeFactory.getTwitterFacade();
   Collections.shuffle(laPerla2800UserIds);
   laPerla2800UserIds = laPerla2800UserIds.subList(0, 200);
   List<String> enrichedTexts = new ArrayList<String>();
   int userCount = 0;
   for (Long userId : laPerla2800UserIds) {
     logger.info("User " + (userCount++) + "/" + laPerla2800UserIds.size());
     List<String> tweetsJsons = null;
     try {
       tweetsJsons = twitterFacade.getLast200Tweets(userId);
     } catch (TwitterException e) {
       e.printStackTrace();
       logger.info("user skipeed");
       continue;
     } catch (ProtectedUserException e) {
       e.printStackTrace();
       logger.info("user skipeed");
       continue;
     }
     List<Tweet> tweets = getTweetsObjectsFromJsons(tweetsJsons);
     tweets = UrlsExapandedTweetsTextExtractor.getUrlsExpandedTextTweets(tweets);
     for (Tweet tweet : tweets) enrichedTexts.add(tweet.urlsExpandedText);
   }
   for (String text : enrichedTexts) {
     System.out.println(text);
   }
 }