List of usage examples for twitter4j UserList getName
String getName();
From source file:twitter4j.examples.list.GetUserLists.java
License:Apache License
/** * Usage: java twitter4j.examples.list.GetUserLists [list owner screen name] * * @param args message//from w ww .ja va2 s .c o m */ public static void main(String[] args) { if (args.length < 1) { System.out.println("Usage: java twitter4j.examples.list.GetUserLists [list owner screen name]"); System.exit(-1); } try { Twitter twitter = new TwitterFactory().getInstance(); ResponseList<UserList> lists = twitter.getUserLists(args[0]); for (UserList list : lists) { System.out.println("id:" + list.getId() + ", name:" + list.getName() + ", description:" + list.getDescription() + ", slug:" + list.getSlug() + ""); } System.exit(0); } catch (TwitterException te) { te.printStackTrace(); System.out.println("Failed to list the lists: " + te.getMessage()); System.exit(-1); } }
From source file:twitter4j.examples.list.GetUserListSubscriptions.java
License:Apache License
/** * Usage: java twitter4j.examples.list.GetUserListSubscriptions [screen name] * * @param args message//from w w w . java2s .c om */ public static void main(String[] args) { if (args.length < 1) { System.out.println("Usage: java twitter4j.examples.list.GetUserListSubscriptions [screen name]"); System.exit(-1); } try { Twitter twitter = new TwitterFactory().getInstance(); long cursor = -1; PagableResponseList<UserList> lists; do { lists = twitter.getUserListSubscriptions(args[0], cursor); for (UserList list : lists) { System.out.println("id:" + list.getId() + ", name:" + list.getName() + ", description:" + list.getDescription() + ", slug:" + list.getSlug() + ""); } } while ((cursor = lists.getNextCursor()) != 0); System.exit(0); } catch (TwitterException te) { te.printStackTrace(); System.out.println("Failed to list the lists: " + te.getMessage()); System.exit(-1); } }
From source file:twitter4j.examples.list.ShowUserList.java
License:Apache License
/** * Usage: java twitter4j.examples.list.ShowUserList [list id] * * @param args message// w ww . j av a 2 s. c o m */ public static void main(String[] args) { if (args.length < 1) { System.out.println("Usage: java twitter4j.examples.list.ShowUserList [list id]"); System.exit(-1); } try { Twitter twitter = new TwitterFactory().getInstance(); UserList list = twitter.showUserList(Integer.parseInt(args[0])); System.out.println("id:" + list.getId() + ", name:" + list.getName() + ", description:" + list.getDescription() + ", slug:" + list.getSlug() + ""); System.exit(0); } catch (TwitterException te) { te.printStackTrace(); System.out.println("Failed to show the list: " + te.getMessage()); System.exit(-1); } }
From source file:twitter4j.examples.list.ShowUserListMembership.java
License:Apache License
/** * Usage: java twitter4j.examples.list.ShowUserListMembership [list id] [user id] * * @param args message/* ww w . j ava 2 s. com*/ */ public static void main(String[] args) { if (args.length < 2) { System.out.println("Usage: java twitter4j.examples.list.ShowUserListMembership [list id] [user id]"); System.exit(-1); } try { Twitter twitter = new TwitterFactory().getInstance(); long listId = Long.parseLong(args[0]); UserList list = twitter.showUserList(listId); long userId = Integer.parseInt(args[1]); User user = twitter.showUser(userId); try { twitter.showUserListMembership(listId, userId); System.out.println("@" + user.getScreenName() + " is in the list:" + list.getName()); } catch (TwitterException te) { if (te.getStatusCode() == 404) { System.out.println("@" + user.getScreenName() + " is not in the list:" + list.getName()); } } System.exit(0); } catch (TwitterException te) { te.printStackTrace(); System.out.println("Failed to check user membership: " + te.getMessage()); System.exit(-1); } }
From source file:twitter4j.examples.list.ShowUserListSubscription.java
License:Apache License
/** * Usage: java twitter4j.examples.list.ShowUserListSubscription [list id] [user id] * * @param args message/*from w w w. j av a2 s. co m*/ */ public static void main(String[] args) { if (args.length < 2) { System.out.println("Usage: java twitter4j.examples.list.ShowUserListSubscription [list id] [user id]"); System.exit(-1); } try { Twitter twitter = new TwitterFactory().getInstance(); long listId = Long.parseLong(args[0]); UserList list = twitter.showUserList(listId); long userId = Integer.parseInt(args[1]); User user = twitter.showUser(userId); try { twitter.showUserListSubscription(listId, userId); System.out.println("@" + user.getScreenName() + " is subscribing the list:" + list.getName()); } catch (TwitterException te) { if (te.getStatusCode() == 404) { System.out.println( "@" + user.getScreenName() + " is not subscribing the list:" + list.getName()); } } System.exit(0); } catch (TwitterException te) { te.printStackTrace(); System.out.println("Failed to check user subscription: " + te.getMessage()); System.exit(-1); } }