예제 #1
0
  @Override
  public void nextTuple() {
    // emit tweets
    Status status = statuses.poll();
    if (status == null) Utils.sleep(1000);
    else {
      ResponseList<User> followers;
      ResponseList<User> friends;

      try {
        Thread.sleep(6000);
        followers = twitter.getFollowersList(status.getUser().getScreenName(), -1);
        Thread.sleep(6000);
        friends = twitter.getFriendsList(status.getUser().getScreenName(), -1);

        if (!followers.isEmpty() && !friends.isEmpty()) {
          spoutOutputCollector.emit(new Values(status, followers, friends));
        }
        // followers.clear();
        // friends.clear();
      } catch (TwitterException ex) {
        ex.printStackTrace();

      } catch (InterruptedException ex) {
        ex.printStackTrace();
      }
    }
  }
예제 #2
0
 public List<User> getFollowing(int num) {
   try {
     List<User> b = new ArrayList<User>();
     for (twitter4j.User u : twitter.getFriendsList(twitter.verifyCredentials().getId(), -1)) {
       b.add(new TwitterUser(u));
     }
     return b;
   } catch (TwitterException e) {
     e.printStackTrace();
     return null;
   }
 }
 public List<User> getFollowees(long id) throws TwitterException {
   List<User> users = null;
   long cursor = -1;
   try {
     Twitter twitter = getConnection().getTwitter();
     users = twitter.getFriendsList(id, cursor);
   } catch (IllegalStateException e) {
     e.printStackTrace();
   } catch (TwitterException e) {
     e.printStackTrace();
   }
   return users;
 }
예제 #4
0
  public FriendsList() throws TwitterException {

    new JPanel();
    FriendsArea = new JTextArea();

    System.out.println("test\n\n");

    friends = twitter.getFriendsList(1155288308, -1);

    System.out.println(friends.size());

    for (User user : friends) {
      // friends2.add(user.getName());
      FriendsArea.append(user.getName() + "\n");
    }

    // FollowersPanel.add(FollowersArea);

    add(FriendsArea);
  }