Example usage for twitter4j User getStatus

List of usage examples for twitter4j User getStatus

Introduction

In this page you can find the example usage for twitter4j User getStatus.

Prototype

Status getStatus();

Source Link

Document

Returns the current status of the user
This can be null if the instance if from Status.getUser().

Usage

From source file:twitter4j.examples.user.LookupUsers.java

License:Apache License

/**
 * Usage: java twitter4j.examples.user.LookupUsers [screen name[,screen name..]]
 *
 * @param args message//from w w w.ja v  a  2  s  .  c  o m
 */
public static void main(String[] args) {
    if (args.length < 1) {
        System.out.println("Usage: java twitter4j.examples.user.LookupUsers [screen name[,screen name..]]");
        System.exit(-1);
    }
    try {
        Twitter twitter = new TwitterFactory().getInstance();
        ResponseList<User> users = twitter.lookupUsers(args[0].split(","));
        for (User user : users) {
            if (user.getStatus() != null) {
                System.out.println("@" + user.getScreenName() + " - " + user.getStatus().getText());
            } else {
                // the user is protected
                System.out.println("@" + user.getScreenName());
            }
        }
        System.out.println("Successfully looked up users [" + args[0] + "].");
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to lookup users: " + te.getMessage());
        System.exit(-1);
    }
}

From source file:twitter4j.examples.user.SearchUsers.java

License:Apache License

/**
 * Usage: java twitter4j.examples.user.SearchUsers [query]
 *
 * @param args message/*  www  . j  a  va 2s  .c  o m*/
 */
public static void main(String[] args) {
    if (args.length < 1) {
        System.out.println("Usage: java twitter4j.examples.user.SearchUsers [query]");
        System.exit(-1);
    }
    try {
        Twitter twitter = new TwitterFactory().getInstance();
        int page = 1;
        ResponseList<User> users;
        do {
            users = twitter.searchUsers(args[0], page);
            for (User user : users) {
                if (user.getStatus() != null) {
                    System.out.println("@" + user.getScreenName() + " - " + user.getStatus().getText());
                } else {
                    // the user is protected
                    System.out.println("@" + user.getScreenName());
                }
            }
            page++;
        } while (users.size() != 0 && page < 50);
        System.out.println("done.");
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to search users: " + te.getMessage());
        System.exit(-1);
    }
}

From source file:twitter4j.examples.user.ShowUser.java

License:Apache License

/**
 * Usage: java twitter4j.examples.user.ShowUser [screen name]
 *
 * @param args message/* w w w.  j  a  v a2 s . c  om*/
 */
public static void main(String[] args) {
    if (args.length < 1) {
        System.out.println("Usage: java twitter4j.examples.user.ShowUser [screen name]");
        System.exit(-1);
    }
    try {
        Twitter twitter = new TwitterFactory().getInstance();
        User user = twitter.showUser(args[0]);
        if (user.getStatus() != null) {
            System.out.println("@" + user.getScreenName() + " - " + user.getStatus().getText());
        } else {
            // the user is protected
            System.out.println("@" + user.getScreenName());
        }
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to delete status: " + te.getMessage());
        System.exit(-1);
    }
}

From source file:TwitterLookUpUsers.LookupUsers.java

License:Apache License

public static void main(String[] args) throws InterruptedException {

    Postgresql.DBBaglan();/* w  w  w.j ava  2 s .  c  o  m*/
    Postgresql.DBSelect();
    Twitter twitter = new TwitterFactory().getInstance();

    for (int j = 0; j < sonuc.length; j++) {

        try {
            User user = twitter.showUser(sonuc[j]);
            if (user.getStatus() != null) {
                System.out.println((j + 1) + ". Sorgu___________________________________");
                System.out.println("@" + user.getScreenName());
                System.out.println(user.getTimeZone());
                System.out.println("@" + user.getName());
                System.out.println("@" + user.getURL());
                System.out.println("LOKASYONN  : " + user.getLocation());
                System.out.println("@" + user.getDescription());
                System.out.println("@" + user.getOriginalProfileImageURL());
                System.out.println("@" + user.getMiniProfileImageURL());
                System.out.println("@" + user.getProfileBackgroundImageURL());
                System.out.println("_______________________________________________");

                if (lokasyon[j].contains(user.getLocation()))

                {
                    System.out.println("KULLANICI BU OLABLR*************************");

                }
            } else {

                // the user is protected
                System.out.println((j + 1) + ". Sorgu______________________________________");
                System.out.println("@" + user.getScreenName() + "---- KULLANICI PUBLIC DEL");
                System.out.println("___________________________________________________");
            }

        }

        catch (TwitterException te)

        {
            te.printStackTrace();

            if ((te.getErrorCode() == 88)) {
                System.err.println("EXCEED..............");
                Thread.sleep(900000); //wait 15 min
            }
            System.out.println();

        }

    }

    System.exit(0);
}