Пример #1
0
 /**
  * This method extracts all the information from the user and returns it.
  *
  * @param userID The user ID as registered with Facebook
  * @return User Information in an object.
  */
 private UserInfo getUserInfo(String userID) {
   User user = null;
   try {
     user = connectionManager.getFacebookClient().fetchObject(userID, User.class);
   } catch (FacebookException e) {
     e.printStackTrace(); // To change body of catch statement use File | Settings | File
     // Templates.
   }
   UserInfo userInfo = new UserInfo(user);
   return userInfo;
 }
Пример #2
0
 private boolean crawlUsers() {
   CommandLine cli = cmdHelper.getParsedCmdLine();
   List<String> usersToCrawl = new ArrayList<String>();
   if (cli.hasOption("uc")) usersToCrawl.add((String) cmdHelper.getOptionValue("uc"));
   else if (cli.hasOption("ul")) {
     String fileName =
         (String)
             cmdHelper.getOptionValue(
                 "ul"); // This line is only there to check if we are getting the file name
     // correctly
     FileUtil.loadFile("UserIDs", usersToCrawl);
   } else return false;
   // Note: This is not efficient. Substitute later with thread pools.
   for (String userID : usersToCrawl) {
     FacebookClient facebookclient = connectionManager.getFacebookClient();
     UserInfo info = getUserInfo(userID);
     info.dump(outputStream);
   }
   return true;
 }