use of twitter4j.TwitterFactory in project twitter4j by yusuke.
the class DestroyUserListSubscription method main.
/**
* Usage: java twitter4j.examples.list.DestroyUserListSubscription [list id]
*
* @param args message
*/
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);
}
}
use of twitter4j.TwitterFactory in project intellij-community by JetBrains.
the class StudyTwitterUtils method getTwitter.
/**
* Set consumer key and secret.
* @return Twitter instance with consumer key and secret set.
*/
@NotNull
public static Twitter getTwitter(@NotNull final String consumerKey, @NotNull final String consumerSecret) {
ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
configurationBuilder.setOAuthConsumerKey(consumerKey);
configurationBuilder.setOAuthConsumerSecret(consumerSecret);
return new TwitterFactory(configurationBuilder.build()).getInstance();
}
Aggregations