Search in sources :

Example 66 with TwitterFactory

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);
    }
}
Also used : Twitter(twitter4j.Twitter) TwitterFactory(twitter4j.TwitterFactory) TwitterException(twitter4j.TwitterException)

Example 67 with TwitterFactory

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();
}
Also used : ConfigurationBuilder(twitter4j.conf.ConfigurationBuilder) TwitterFactory(twitter4j.TwitterFactory) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

TwitterFactory (twitter4j.TwitterFactory)67 Twitter (twitter4j.Twitter)59 TwitterException (twitter4j.TwitterException)55 ConfigurationBuilder (twitter4j.conf.ConfigurationBuilder)9 Status (twitter4j.Status)7 IDs (twitter4j.IDs)6 AccessToken (twitter4j.auth.AccessToken)5 SavedSearch (twitter4j.SavedSearch)4 RequestToken (twitter4j.auth.RequestToken)4 File (java.io.File)3 User (twitter4j.User)3 UserList (twitter4j.UserList)3 Intent (android.content.Intent)2 AppSettings (com.klinker.android.twitter.settings.AppSettings)2 HttpServletRouter (h2weibo.HttpServletRouter)2 HashMap (java.util.HashMap)2 HttpSession (javax.servlet.http.HttpSession)2 DirectMessage (twitter4j.DirectMessage)2 Relationship (twitter4j.Relationship)2 Configuration (twitter4j.conf.Configuration)2