List of usage examples for twitter4j TwitterException getMessage
@Override
public String getMessage()
From source file:twitter4j.examples.list.DeleteUserListMember.java
License:Apache License
/** * Usage: java twitter4j.examples.list.DeleteUserListMember [list id] [user id] * * @param args message/*from w ww.j ava 2 s. c o m*/ */ public static void main(String[] args) { if (args.length < 2) { System.out.println("Usage: java twitter4j.examples.list.DeleteUserListMember [list id] [user id]"); System.exit(-1); } try { Twitter twitter = new TwitterFactory().getInstance(); twitter.destroyUserListMember(Integer.parseInt(args[0]), Integer.parseInt(args[1])); System.out.println("Successfully deleted user [" + args[1] + "] from the list."); System.exit(0); } catch (TwitterException te) { te.printStackTrace(); System.out.println("Failed to delete user: " + te.getMessage()); System.exit(-1); } }
From source file:twitter4j.examples.list.DestroyUserList.java
License:Apache License
/** * Usage: java twitter4j.examples.list.DestroyUserList [list id] * * @param args message//from w w w . ja va2 s . co m */ public static void main(String[] args) { if (args.length < 1) { System.out.println("Usage: java twitter4j.examples.list.DestroyUserList [list id]"); System.exit(-1); } try { Twitter twitter = new TwitterFactory().getInstance(); UserList list = twitter.destroyUserList(Integer.parseInt(args[0])); System.out.println( "Successfully deleted the list (id:" + list.getId() + ", slug:" + list.getSlug() + ")."); System.exit(0); } catch (TwitterException te) { te.printStackTrace(); System.out.println("Failed to delete a list: " + te.getMessage()); System.exit(-1); } }
From source file:twitter4j.examples.list.DestroyUserListSubscription.java
License:Apache License
/** * Usage: java twitter4j.examples.list.DestroyUserListSubscription [list id] * * @param args message//from w w w.j a v a 2 s. c o m */ public static void main(String[] args) { if (args.length < 1) { System.out.println("Usage: java twitter4j.examples.list.DestroyUserListSubscription [list id]"); System.exit(-1); } try { Twitter twitter = new TwitterFactory().getInstance(); twitter.destroyUserListSubscription(Integer.parseInt(args[0])); System.out.println("Successfully unsubscribed the list."); System.exit(0); } catch (TwitterException te) { te.printStackTrace(); System.out.println("Failed to unsubscribe the list: " + te.getMessage()); System.exit(-1); } }
From source file:twitter4j.examples.list.GetUserListMembers.java
License:Apache License
/** * Usage: java twitter4j.examples.list.GetUserListMembers [list owner screen name] [list id] * * @param args message/* w w w. j av a 2 s. c om*/ */ public static void main(String[] args) { if (args.length < 1) { System.out.println("Usage: java twitter4j.examples.list.GetUserListMembers [list id]"); System.exit(-1); } try { Twitter twitter = new TwitterFactory().getInstance(); long cursor = -1; PagableResponseList<User> usres; do { usres = twitter.getUserListMembers(Integer.parseInt(args[0]), cursor); for (User list : usres) { System.out.println("@" + list.getScreenName()); } } while ((cursor = usres.getNextCursor()) != 0); System.exit(0); } catch (TwitterException te) { te.printStackTrace(); System.out.println("Failed to get list members: " + te.getMessage()); System.exit(-1); } }
From source file:twitter4j.examples.list.GetUserListMemberships.java
License:Apache License
/** * Usage: java twitter4j.examples.list.GetUserListMemberships [list member screen name] * * @param args message/*from ww w . j av a2 s . co m*/ */ public static void main(String[] args) { if (args.length < 1) { System.out.println( "Usage: java twitter4j.examples.list.GetUserListMemberships [list member screen name]"); System.exit(-1); } try { Twitter twitter = new TwitterFactory().getInstance(); long cursor = -1; PagableResponseList<UserList> lists; do { lists = twitter.getUserListMemberships(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.GetUserLists.java
License:Apache License
/** * Usage: java twitter4j.examples.list.GetUserLists [list owner screen name] * * @param args message//from w ww .j a v a 2 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.GetUserListSubscribers.java
License:Apache License
/** * Usage: java twitter4j.examples.list.GetUserListSubscribers [list id] * * @param args message/* w ww . ja v a2 s . com*/ */ public static void main(String[] args) { if (args.length < 1) { System.out.println("Usage: java twitter4j.examples.list.GetUserListSubscribers [list id]"); System.exit(-1); } try { Twitter twitter = new TwitterFactory().getInstance(); long cursor = -1; PagableResponseList<User> usres; do { usres = twitter.getUserListSubscribers(Integer.parseInt(args[0]), cursor); for (User list : usres) { System.out.println("@" + list.getScreenName()); } } while ((cursor = usres.getNextCursor()) != 0); System.exit(0); } catch (TwitterException te) { te.printStackTrace(); System.out.println("Failed to get list subscribers: " + 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 ww w. jav a2 s .com*/ */ 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//from w w w. j a v a2 s . c om */ 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//from w w w . j ava2 s. c om */ 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); } }