use of twitter4j.TwitterException in project twitter4j by yusuke.
the class UpdateUserList method main.
/**
* Usage: java twitter4j.examples.list.UpdateUserList [list id] [new list name] [new description]
*
* @param args message
*/
public static void main(String[] args) {
if (args.length < 3) {
System.out.println("Usage: java twitter4j.examples.list.UpdateUserList [list id] [new list name] [new description]");
System.exit(-1);
}
try {
Twitter twitter = new TwitterFactory().getInstance();
twitter.updateUserList(Integer.parseInt(args[0]), args[1], true, args[2]);
System.out.println("Successfully updated list [" + args[0] + "].");
System.exit(0);
} catch (TwitterException te) {
te.printStackTrace();
System.out.println("Failed to update list: " + te.getMessage());
System.exit(-1);
}
}
use of twitter4j.TwitterException in project twitter4j by yusuke.
the class GetMutingUsersIDs method main.
/**
* Usage: java twitter4j.examples.mute.GetMutingUsersIDs
*
* @param args message
*/
public static void main(String[] args) {
try {
Twitter twitter = new TwitterFactory().getInstance();
IDs ids = twitter.getMutesIDs(-1L);
for (long id : ids.getIDs()) {
System.out.println(id);
}
System.out.println("done.");
System.exit(0);
} catch (TwitterException te) {
te.printStackTrace();
System.out.println("Failed to get muting user ids: " + te.getMessage());
System.exit(-1);
}
}
use of twitter4j.TwitterException in project twitter4j by yusuke.
the class UpdateProfile method main.
/**
* Usage: java twitter4j.examples.account.UpdateProfile [name] [url] [location] [description]
*
* @param args message
*/
public static void main(String[] args) {
if (args.length < 4) {
System.out.println("Usage: java twitter4j.examples.account.UpdateProfile [name] [url] [location] [description]");
System.exit(-1);
}
try {
Twitter twitter = new TwitterFactory().getInstance();
twitter.updateProfile(args[0], args[1], args[2], args[3]);
System.out.println("Successfully updated profile.");
System.exit(0);
} catch (TwitterException te) {
te.printStackTrace();
System.out.println("Failed to update profile: " + te.getMessage());
System.exit(-1);
}
}
use of twitter4j.TwitterException in project twitter4j by yusuke.
the class VerifyCredentials method main.
/**
* Usage: java twitter4j.examples.account.VerifyCredentials
*
* @param args message
*/
public static void main(String[] args) {
try {
Twitter twitter = new TwitterFactory().getInstance();
User user = twitter.verifyCredentials();
System.out.println("Successfully verified credentials of " + user.getScreenName());
System.exit(0);
} catch (TwitterException te) {
te.printStackTrace();
System.out.println("Failed to verify credentials: " + te.getMessage());
System.exit(-1);
}
}
use of twitter4j.TwitterException in project twitter4j by yusuke.
the class GetBlockingUsers method main.
/**
* Usage: java twitter4j.examples.block.GetBlockingUsers
*
* @param args message
*/
public static void main(String[] args) {
try {
Twitter twitter = new TwitterFactory().getInstance();
int page = 1;
List<User> users;
do {
users = twitter.getBlocksList(page);
for (User user : users) {
System.out.println("@" + user.getScreenName());
}
page++;
// this code ends up in an infinite loop due to the issue 1988
// http://code.google.com/p/twitter-api/issues/detail?id=1988
} while (users.size() > 0 && page <= 10);
System.out.println("done.");
System.exit(0);
} catch (TwitterException te) {
te.printStackTrace();
System.out.println("Failed to get blocking users: " + te.getMessage());
System.exit(-1);
}
}
Aggregations