Package twitter4j

Examples of twitter4j.Twitter$Device


        if (args.length < 1) {
            System.out.println("java twitter4j.examples.spamreporting.ReportSpam [screen name]");
            System.exit(-1);
        }
        try {
            Twitter twitter = new TwitterFactory().getInstance();
            System.out.println("Successfully reported @" + twitter.reportSpam(args[0]).getScreenName() + " as a spammer.");
        } catch (TwitterException te) {
            te.printStackTrace();
            System.out.println("Failed to report spam: " + te.getMessage());
            System.exit(-1);
        }
View Full Code Here


        if (args.length < 1) {
            System.out.println("Usage: java twitter4j.examples.friendship.CreateFriendship [screen name]");
            System.exit(-1);
        }
        try {
            Twitter twitter = new TwitterFactory().getInstance();
            twitter.createFriendship(args[0]);
            System.out.println("Successfully followed [" + args[0] + "].");
            System.exit(0);
        } catch (TwitterException te) {
            te.printStackTrace();
            System.out.println("Failed to follow: " + te.getMessage());
View Full Code Here

     *
     * @param args String[]
     */
    public static void main(String[] args) {
        // gets Twitter instance with default credentials
        Twitter twitter = new TwitterFactory().getInstance();
        try {
            List<Status> statuses;
            String user;
            if (args.length == 1) {
                user = args[0];
                statuses = twitter.getUserTimeline(user);
            } else {
                user = twitter.verifyCredentials().getScreenName();
                statuses = twitter.getUserTimeline();
            }
            System.out.println("Showing @" + user + "'s user timeline.");
            for (Status status : statuses) {
                System.out.println("@" + status.getUser().getScreenName() + " - " + status.getText());
            }
View Full Code Here

     *
     * @param args message
     */
    public static void main(String[] args) {
        try {
            Twitter twitter = new TwitterFactory().getInstance();
            long cursor = -1;
            IDs ids;
            System.out.println("Showing outgoing pending follow request(s).");
            do {
                ids = twitter.getOutgoingFriendships(cursor);
                for (long id : ids.getIDs()) {
                    System.out.println(id);
                }
            } while ((cursor = ids.getNextCursor()) != 0);
            System.exit(0);
View Full Code Here

     *
     * @param args message
     */
    public static void main(String[] args) {
        try {
            Twitter twitter = new TwitterFactory().getInstance();
            long cursor = -1;
            IDs ids;
            System.out.println("Listing followers's ids.");
            do {
                if (0 < args.length) {
                    ids = twitter.getFollowersIDs(args[0], cursor);
                } else {
                    ids = twitter.getFollowersIDs(cursor);
                }
                for (long id : ids.getIDs()) {
                    System.out.println(id);
                }
            } while ((cursor = ids.getNextCursor()) != 0);
View Full Code Here

        if (args.length < 1) {
            System.out.println("Usage: java twitter4j.examples.friendship.DestroyFriendship [screen name]");
            System.exit(-1);
        }
        try {
            Twitter twitter = new TwitterFactory().getInstance();
            twitter.destroyFriendship(args[0]);
            System.out.println("Successfully unfollowed [" + args[0] + "].");
            System.exit(0);
        } catch (TwitterException te) {
            te.printStackTrace();
            System.out.println("Failed to unfollow: " + te.getMessage());
View Full Code Here

     *
     * @param args message
     */
    public static void main(String[] args) {
        try {
            Twitter twitter = new TwitterFactory().getInstance();
            long cursor = -1;
            IDs ids;
            System.out.println("Listing following ids.");
            do {
                if (0 < args.length) {
                    ids = twitter.getFriendsIDs(args[0], cursor);
                } else {
                    ids = twitter.getFriendsIDs(cursor);
                }
                for (long id : ids.getIDs()) {
                    System.out.println(id);
                }
            } while ((cursor = ids.getNextCursor()) != 0);
View Full Code Here

        if (args.length < 1) {
            System.out.println("Usage: java twitter4j.examples.tweets.ShowStatus [status id]");
            System.exit(-1);
        }
        try {
            Twitter twitter = new TwitterFactory().getInstance();
            Status status = twitter.showStatus(Long.parseLong(args[0]));
            System.out.println("@" + status.getUser().getScreenName() + " - " + status.getText());
            System.exit(0);
        } catch (TwitterException te) {
            te.printStackTrace();
            System.out.println("Failed to show status: " + te.getMessage());
View Full Code Here

            System.out.println("Usage: java twitter4j.examples.tweets.RetweetStatus [status id]");
            System.exit(-1);
        }
        System.out.println("Retweeting the status id - [" + args[0] + "].");
        try {
            Twitter twitter = new TwitterFactory().getInstance();
            twitter.retweetStatus(Long.parseLong(args[0]));
            System.out.println("Successfully retweeted status [" + args[0] + "].");
            System.exit(0);
        } catch (TwitterException te) {
            te.printStackTrace();
            System.out.println("Failed to retweet: " + te.getMessage());
View Full Code Here

        if (args.length < 1) {
            System.out.println("Usage: java twitter4j.examples.tweets.UploadMultipleImages [text] [file1] [file2] ...");
            System.exit(-1);
        }
        try {
            Twitter twitter = new TwitterFactory().getInstance();
           
            long[] mediaIds = new long[args.length-1];
            for (int i=1; i<args.length; i++) {
                System.out.println("Uploading...[" + i + "/" + (args.length-1) + "][" + args[i] + "]");
                UploadedMedia media = twitter.uploadMedia(new File(args[i]));
                System.out.println("Uploaded: id=" + media.getMediaId()
                        + ", w=" + media.getImageWidth() + ", h=" + media.getImageHeight()
                        + ", type=" + media.getImageType() + ", size=" + media.getSize());
                mediaIds[i-1] = media.getMediaId();
            }
           
            StatusUpdate update = new StatusUpdate(args[0]);
            update.setMediaIds(mediaIds);
            Status status = twitter.updateStatus(update);
            System.out.println("Successfully updated the status to [" + status.getText() + "][" + status.getId() + "].");
            System.exit(0);
        } catch (TwitterException te) {
            te.printStackTrace();
            System.out.println("Failed to update status: " + te.getMessage());
View Full Code Here

TOP

Related Classes of twitter4j.Twitter$Device

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.