Search in sources :

Example 51 with TwitterFactory

use of twitter4j.TwitterFactory in project twitter4j by yusuke.

the class UpdateProfileBackgroundImage method main.

/**
     * Usage: java twitter4j.examples.account.UpdateProfileBackgroundImage [image file path] [tiled('true' or 'false')
     *
     * @param args message
     */
public static void main(String[] args) {
    if (args.length < 1) {
        System.out.println("Usage: java twitter4j.examples.account.UpdateProfileBackgroundImage [image file path] [tiled('true' or 'false')");
        System.exit(-1);
    }
    boolean tiled = false;
    if (args.length >= 2) {
        tiled = Boolean.parseBoolean(args[1]);
    }
    try {
        Twitter twitter = new TwitterFactory().getInstance();
        twitter.updateProfileBackgroundImage(new File(args[0]), tiled);
        System.out.println("Successfully updated profile background image.");
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to update profile background image: " + te.getMessage());
        System.exit(-1);
    }
}
Also used : Twitter(twitter4j.Twitter) TwitterFactory(twitter4j.TwitterFactory) File(java.io.File) TwitterException(twitter4j.TwitterException)

Example 52 with TwitterFactory

use of twitter4j.TwitterFactory in project twitter4j by yusuke.

the class UpdateProfileImage method main.

/**
     * Usage: java twitter4j.examples.account.UpdateProfileImage [image file path]
     *
     * @param args message
     */
public static void main(String[] args) {
    if (args.length < 1) {
        System.out.println("Usage: java twitter4j.examples.account.UpdateProfileImage [image file path]");
        System.exit(-1);
    }
    try {
        Twitter twitter = new TwitterFactory().getInstance();
        twitter.updateProfileImage(new File(args[0]));
        System.out.println("Successfully updated profile image.");
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to update profile image: " + te.getMessage());
        System.exit(-1);
    }
}
Also used : Twitter(twitter4j.Twitter) TwitterFactory(twitter4j.TwitterFactory) File(java.io.File) TwitterException(twitter4j.TwitterException)

Example 53 with TwitterFactory

use of twitter4j.TwitterFactory in project twitter4j by yusuke.

the class CreateBlock method main.

/**
     * Usage: java twitter4j.examples.block.CreateBlock [screen name]
     *
     * @param args message
     */
public static void main(String[] args) {
    if (args.length < 1) {
        System.out.println("Usage: java twitter4j.examples.block.CreateBlock [screen name]");
        System.exit(-1);
    }
    try {
        Twitter twitter = new TwitterFactory().getInstance();
        twitter.createBlock(args[0]);
        System.out.println("Successfully blocked user [" + args[0] + "].");
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to block user: " + te.getMessage());
        System.exit(-1);
    }
}
Also used : Twitter(twitter4j.Twitter) TwitterFactory(twitter4j.TwitterFactory) TwitterException(twitter4j.TwitterException)

Example 54 with TwitterFactory

use of twitter4j.TwitterFactory in project twitter4j by yusuke.

the class DestroyBlock method main.

/**
     * Usage: java twitter4j.examples.block.DestroyBlock [screen name]
     *
     * @param args message
     */
public static void main(String[] args) {
    if (args.length < 1) {
        System.out.println("Usage: java twitter4j.examples.block.DestroyBlock [screen name]");
        System.exit(-1);
    }
    try {
        Twitter twitter = new TwitterFactory().getInstance();
        twitter.destroyBlock(args[0]);
        System.out.println("Successfully unblocked user [" + args[0] + "].");
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to unblock user: " + te.getMessage());
        System.exit(-1);
    }
}
Also used : Twitter(twitter4j.Twitter) TwitterFactory(twitter4j.TwitterFactory) TwitterException(twitter4j.TwitterException)

Example 55 with TwitterFactory

use of twitter4j.TwitterFactory in project twitter4j by yusuke.

the class GetBlockingUsersIDs method main.

/**
     * Usage: java twitter4j.examples.block.GetBlockingUsersIDs
     *
     * @param args message
     */
public static void main(String[] args) {
    try {
        Twitter twitter = new TwitterFactory().getInstance();
        IDs ids = twitter.getBlocksIDs();
        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 blocking user ids: " + te.getMessage());
        System.exit(-1);
    }
}
Also used : Twitter(twitter4j.Twitter) IDs(twitter4j.IDs) TwitterFactory(twitter4j.TwitterFactory) TwitterException(twitter4j.TwitterException)

Aggregations

TwitterFactory (twitter4j.TwitterFactory)68 Twitter (twitter4j.Twitter)60 TwitterException (twitter4j.TwitterException)55 ConfigurationBuilder (twitter4j.conf.ConfigurationBuilder)10 Status (twitter4j.Status)7 IDs (twitter4j.IDs)6 AccessToken (twitter4j.auth.AccessToken)5 SavedSearch (twitter4j.SavedSearch)4 RequestToken (twitter4j.auth.RequestToken)4 Configuration (twitter4j.conf.Configuration)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 AccessToken (twitter4j.http.AccessToken)2 AlarmManager (android.app.AlarmManager)1