Example usage for twitter4j User getFollowersCount

List of usage examples for twitter4j User getFollowersCount

Introduction

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

Prototype

int getFollowersCount();

Source Link

Document

Returns the number of followers

Usage

From source file:com.eventattend.portal.bl.TwitterBL.java

License:Open Source License

public TwitterDTO fetchProfile(User user, TwitterDTO twitterDTO) {
    System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
    String userDesc = null;//  ww w. j a v a2s . com
    String favCount = null;
    String followCount = null;
    String friendsCount = null;
    String location = null;
    String name = null;
    String profImgUrl = null;
    String personalUrl = null;
    String twitterURL = "http://twitter.com/" + user.getScreenName();
    userDesc = user.getDescription();
    favCount = String.valueOf(user.getFavouritesCount());
    followCount = String.valueOf(user.getFollowersCount());
    friendsCount = String.valueOf(user.getFriendsCount());
    location = user.getLocation();
    name = user.getName();
    profImgUrl = String.valueOf(user.getProfileImageURL());
    //   System.out.println("User ID   >>  "+user.getId());
    //System.out.println("TwitterA/C CreatedAt  >>  "+user.getCreatedAt());
    System.out.println("Description   >>  " + user.getDescription());
    System.out.println("FavouritesCount   >>  " + user.getFavouritesCount());
    System.out.println("FollowersCoun   >>  " + user.getFollowersCount());
    System.out.println("FriendsCount   >>  " + user.getFriendsCount());
    System.out.println("Language   >>  " + user.getLang());
    System.out.println("Location >>  " + user.getLocation());
    System.out.println("Name  >>  " + user.getName());
    System.out.println("ProfileImageURL   >>  " + user.getProfileImageURL());
    System.out.println("Total tweets   >>  " + user.getStatusesCount());

    if (twitterURL != null) {
        twitterDTO.setUserURL(twitterURL);
        System.out.println("Twitter URL   >>  " + twitterURL);
    }
    if (userDesc != null && (!userDesc.equals(""))) {
        twitterDTO.setUserDesc(userDesc);
    } else {
        twitterDTO.setUserDesc(null);
    }
    if (favCount != null) {
        twitterDTO.setUserFavCount(favCount);
    }
    if (followCount != null) {
        twitterDTO.setFollowersCount(followCount);
    }
    if (friendsCount != null) {

        twitterDTO.setFriendsCount(friendsCount);
    }
    if (location != null) {
        twitterDTO.setUserLocation(location);
    }
    if (name != null) {
        twitterDTO.setUserName(name);
    }
    if (profImgUrl != null) {
        twitterDTO.setUserImg(profImgUrl);
    }
    if (user.getURL() != null) {
        if (!user.getURL().equals(twitterURL)) {
            personalUrl = String.valueOf(user.getURL());
            System.out.println("Personal URL   >>  " + user.getURL());
            twitterDTO.setPersonalUrl(personalUrl);
        }
    }
    //   Status status=user.getStatus();
    //   System.out.println("Latest Tweet  >> TweetId "+status.getId()+"|Tweet> "+status.getText()+" |via> "+status.getSource()
    //         +"|Loc >"+status.getGeoLocation()+"|tweetTime >"+status.getCreatedAt()+"Place Details we can get >"+status.getPlace());         
    /*System.out.println("RateLimitStatus   >>  "+user.getRateLimitStatus());
    System.out.println("ProfileBackgroundColor   >>  "+user.getProfileBackgroundColor());
    System.out.println("ProfileBackgroundImageUrl   >>  "+user.getProfileBackgroundImageUrl());
    System.out.println("ProfileLinkColor   >>  "+user.getProfileLinkColor());
    System.out.println("ProfileSidebarBorderColor   >>  "+user.getProfileSidebarBorderColor());
    System.out.println("user.getProfileSidebarFillColor()   >>  "+user.getProfileSidebarFillColor());
    System.out.println("ProfileTextColor   >>  "+user.getProfileTextColor());*/
    return twitterDTO;
}

From source file:com.freshdigitable.udonroad.module.realm.UserRealm.java

License:Apache License

UserRealm(final User user) {
    this.id = user.getId();
    this.profileImageURLHttps = user.getProfileImageURLHttps();
    this.miniProfileImageURLHttps = user.getMiniProfileImageURLHttps();
    this.name = user.getName();
    this.screenName = user.getScreenName();
    this.description = user.getDescription();
    this.profileBannerMobileURL = user.getProfileBannerMobileURL();
    this.statusesCount = user.getStatusesCount();
    this.followersCount = user.getFollowersCount();
    this.friendsCount = user.getFriendsCount();
    this.favoritesCount = user.getFavouritesCount();
    this.profileLinkColor = user.getProfileLinkColor();
    this.descriptionURLEntities = URLEntityRealm.createList(user.getDescriptionURLEntities());
    this.url = user.getURL();
    if (user.getURLEntity() != null) {
        this.urlEntity = new URLEntityRealm(user.getURLEntity());
    }//from w w  w.j  av a  2  s . c o m
    this.location = user.getLocation();
    this.verified = user.isVerified();
    this.isProtected = user.isProtected();
}

From source file:com.freshdigitable.udonroad.module.realm.UserRealm.java

License:Apache License

void merge(@NonNull User u, @NonNull Realm realm) {
    if (u.getDescription() != null) { // description is nullable
        this.description = u.getDescription();
        final URLEntity[] descriptionURLEntities = u.getDescriptionURLEntities();
        if (descriptionURLEntities != null && descriptionURLEntities.length > 0) {
            this.descriptionURLEntities.clear();
            for (URLEntity url : descriptionURLEntities) {
                this.descriptionURLEntities.add(URLEntityRealm.findOrCreateFromRealm(url, realm));
            }/*  w ww .ja  v  a 2 s  . c o  m*/
        }
    }
    this.favoritesCount = u.getFavouritesCount();
    this.followersCount = u.getFollowersCount();
    this.friendsCount = u.getFriendsCount();
    this.miniProfileImageURLHttps = u.getMiniProfileImageURLHttps();
    this.name = u.getName();
    this.profileBannerMobileURL = u.getProfileBannerMobileURL();
    this.profileImageURLHttps = u.getProfileImageURLHttps();
    this.profileLinkColor = u.getProfileLinkColor();
    this.screenName = u.getScreenName();
    this.statusesCount = u.getStatusesCount();
    this.url = u.getURL();
    final URLEntity urlEntity = u.getURLEntity();
    if (urlEntity != null && isNewUrlEntity(urlEntity)) {
        this.urlEntity = URLEntityRealm.findOrCreateFromRealm(urlEntity, realm);
    }
    this.location = u.getLocation();
    this.verified = u.isVerified();
    this.isProtected = u.isProtected();
}

From source file:com.github.gorbin.asne.twitter.TwitterSocialNetwork.java

License:Open Source License

private TwitterPerson getDetailedSocialPerson(TwitterPerson twitterPerson, User user) {
    getSocialPerson(twitterPerson, user);
    twitterPerson.createdDate = user.getCreatedAt().getTime();
    twitterPerson.description = user.getDescription();
    twitterPerson.favoritesCount = user.getFavouritesCount();
    twitterPerson.followersCount = user.getFollowersCount();
    twitterPerson.friendsCount = user.getFriendsCount();
    twitterPerson.lang = user.getLang();
    twitterPerson.location = user.getLocation();
    twitterPerson.screenName = user.getScreenName();
    if (user.getStatus() != null) {
        twitterPerson.status = user.getStatus().getText();
    } else {//from w w w  . ja v a  2  s  .c o m
        twitterPerson.status = null;
    }
    twitterPerson.timezone = user.getTimeZone();
    twitterPerson.isTranslator = user.isTranslator();
    twitterPerson.isVerified = user.isVerified();
    return twitterPerson;
}

From source file:com.github.jcustenborder.kafka.connect.twitter.StatusConverter.java

License:Apache License

public static void convert(User user, Struct struct) {
    struct.put("Id", user.getId()).put("Name", user.getName()).put("ScreenName", user.getScreenName())
            .put("Location", user.getLocation()).put("Description", user.getDescription())
            .put("ContributorsEnabled", user.isContributorsEnabled())
            .put("ProfileImageURL", user.getProfileImageURL())
            .put("BiggerProfileImageURL", user.getBiggerProfileImageURL())
            .put("MiniProfileImageURL", user.getMiniProfileImageURL())
            .put("OriginalProfileImageURL", user.getOriginalProfileImageURL())
            .put("ProfileImageURLHttps", user.getProfileImageURLHttps())
            .put("BiggerProfileImageURLHttps", user.getBiggerProfileImageURLHttps())
            .put("MiniProfileImageURLHttps", user.getMiniProfileImageURLHttps())
            .put("OriginalProfileImageURLHttps", user.getOriginalProfileImageURLHttps())
            .put("DefaultProfileImage", user.isDefaultProfileImage()).put("URL", user.getURL())
            .put("Protected", user.isProtected()).put("FollowersCount", user.getFollowersCount())
            .put("ProfileBackgroundColor", user.getProfileBackgroundColor())
            .put("ProfileTextColor", user.getProfileTextColor())
            .put("ProfileLinkColor", user.getProfileLinkColor())
            .put("ProfileSidebarFillColor", user.getProfileSidebarFillColor())
            .put("ProfileSidebarBorderColor", user.getProfileSidebarBorderColor())
            .put("ProfileUseBackgroundImage", user.isProfileUseBackgroundImage())
            .put("DefaultProfile", user.isDefaultProfile())
            .put("ShowAllInlineMedia", user.isShowAllInlineMedia()).put("FriendsCount", user.getFriendsCount())
            .put("CreatedAt", user.getCreatedAt()).put("FavouritesCount", user.getFavouritesCount())
            .put("UtcOffset", user.getUtcOffset()).put("TimeZone", user.getTimeZone())
            .put("ProfileBackgroundImageURL", user.getProfileBackgroundImageURL())
            .put("ProfileBackgroundImageUrlHttps", user.getProfileBackgroundImageUrlHttps())
            .put("ProfileBannerURL", user.getProfileBannerURL())
            .put("ProfileBannerRetinaURL", user.getProfileBannerRetinaURL())
            .put("ProfileBannerIPadURL", user.getProfileBannerIPadURL())
            .put("ProfileBannerIPadRetinaURL", user.getProfileBannerIPadRetinaURL())
            .put("ProfileBannerMobileURL", user.getProfileBannerMobileURL())
            .put("ProfileBannerMobileRetinaURL", user.getProfileBannerMobileRetinaURL())
            .put("ProfileBackgroundTiled", user.isProfileBackgroundTiled()).put("Lang", user.getLang())
            .put("StatusesCount", user.getStatusesCount()).put("GeoEnabled", user.isGeoEnabled())
            .put("Verified", user.isVerified()).put("Translator", user.isTranslator())
            .put("ListedCount", user.getListedCount()).put("FollowRequestSent", user.isFollowRequestSent());

    List<String> withheldInCountries = new ArrayList<>();
    if (null != user.getWithheldInCountries()) {
        for (String s : user.getWithheldInCountries()) {
            withheldInCountries.add(s);//from  w  w  w.java  2s  . c  o m
        }
    }
    struct.put("WithheldInCountries", withheldInCountries);

}

From source file:com.javielinux.infos.InfoUsers.java

License:Apache License

public InfoUsers(User user) {
    setId(user.getId());//from  w w  w  .j  av  a  2  s . c o m
    setName(user.getScreenName());
    setFullname(user.getName());
    setCreated(user.getCreatedAt());
    setLocation(user.getLocation());
    if (user.getURL() != null)
        setUrl(user.getURL().toString());
    setFollowers(user.getFollowersCount());
    setFollowing(user.getFriendsCount());
    setTweets(user.getStatusesCount());
    setBio(user.getDescription());
    if (user.getStatus() != null)
        setTextTweet(user.getStatus().getText());
    setUrlAvatar(user.getProfileImageURL().toString());

    ArrayList<Entity> ents = DataFramework.getInstance().getEntityList("users",
            "service is null or service = \"twitter.com\"");

    for (Entity ent : ents) {
        friendly.put(ent.getString("name"), new Friend(ent.getString("name")));
    }

}

From source file:com.marpies.ane.twitter.utils.UserUtils.java

License:Apache License

public static JSONObject getJSON(User user) throws JSONException {
    JSONObject userJSON = new JSONObject();
    userJSON.put("id", user.getId());
    userJSON.put("screenName", user.getScreenName());
    userJSON.put("name", user.getName());
    userJSON.put("createdAt", user.getCreatedAt());
    userJSON.put("description", user.getDescription());
    userJSON.put("tweetsCount", user.getStatusesCount());
    userJSON.put("likesCount", user.getFavouritesCount());
    userJSON.put("followersCount", user.getFollowersCount());
    userJSON.put("friendsCount", user.getFriendsCount());
    userJSON.put("profileImageURL", user.getProfileImageURL());
    userJSON.put("isProtected", user.isProtected());
    userJSON.put("isVerified", user.isVerified());
    userJSON.put("location", user.getLocation());
    return userJSON;
}

From source file:com.michaelfitzmaurice.clocktwerk.apps.FollowerCounter.java

License:Apache License

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

    File outputDir = new File(args[0]);
    String[] users = new String[args.length - 1];
    System.arraycopy(args, 1, users, 0, users.length);

    LOG.info("Setting up Twitter client...");
    Twitter twitter = new TwitterFactory().getInstance();
    LOG.info("Twitter client connected");

    LOG.info("Getting followers for users " + Arrays.asList(users));
    ResponseList<User> foundUsers = twitter.lookupUsers(users);
    for (User user : foundUsers) {
        LOG.info("\t'{}' has {} followers", user.getName(), user.getFollowersCount());
        recordFollowersToCsv(outputDir, user.getScreenName(), user.getFollowersCount());
    }/*  w  w  w  .j  a  v a  2  s  .  c o  m*/
}

From source file:com.raythos.sentilexo.twitter.domain.QueryResultItemMapper.java

License:Apache License

public static TwitterQueryResultItemAvro mapItem(String queryOwner, String queryName, String queryString,
        Status status) {/*  www  .j  a v a  2s.  c o m*/
    TwitterQueryResultItemAvro result = new TwitterQueryResultItemAvro();

    if (queryName != null)
        queryName = queryName.toLowerCase();
    if (queryOwner != null)
        queryOwner = queryOwner.toLowerCase();

    result.setQueryName(queryName);
    result.setQueryOwner(queryOwner);
    result.setQuery(queryString);
    result.setStatusId(status.getId());
    result.setText(status.getText());

    result.setRelevantQueryTerms(TwitterUtils.relevantQueryTermsFromStatus(queryString, status));
    result.setLang(status.getLang());

    result.setCreatedAt(status.getCreatedAt().getTime());

    User user = status.getUser();
    result.setUserId(user.getId());
    result.setScreenName(user.getScreenName());
    result.setUserLocation(user.getLocation());
    result.setUserName(user.getName());
    result.setUserDescription(user.getDescription());
    result.setUserIsProtected(user.isProtected());
    result.setUserFollowersCount(user.getFollowersCount());
    result.setUserCreatedAt(user.getCreatedAt().getTime());
    result.setUserCreatedAtAsString(DateTimeUtils.getDateAsText(user.getCreatedAt()));
    result.setCreatedAtAsString(DateTimeUtils.getDateAsText(status.getCreatedAt()));
    result.setUserFriendsCount(user.getFriendsCount());
    result.setUserListedCount(user.getListedCount());
    result.setUserStatusesCount(user.getStatusesCount());
    result.setUserFavoritesCount(user.getFavouritesCount());

    result.setCurrentUserRetweetId(status.getCurrentUserRetweetId());

    result.setInReplyToScreenName(status.getInReplyToScreenName());
    result.setInReplyToStatusId(status.getInReplyToStatusId());
    result.setInReplyToUserId(status.getInReplyToUserId());

    if (status.getGeoLocation() != null) {
        result.setLatitude(status.getGeoLocation().getLatitude());
        result.setLongitude(status.getGeoLocation().getLongitude());
    }

    result.setSource(status.getSource());
    result.setTrucated(status.isTruncated());
    result.setPossiblySensitive(status.isPossiblySensitive());

    result.setRetweet(status.getRetweetedStatus() != null);
    if (result.getRetweet()) {
        result.setRetweetStatusId(status.getRetweetedStatus().getId());
        result.setRetweetedText(status.getRetweetedStatus().getText());
    }
    result.setRetweeted(status.isRetweeted());
    result.setRetweetCount(status.getRetweetCount());
    result.setRetweetedByMe(status.isRetweetedByMe());

    result.setFavoriteCount(status.getFavoriteCount());
    result.setFavourited(status.isFavorited());

    if (status.getPlace() != null) {
        result.setPlace(status.getPlace().getFullName());
    }

    Scopes scopesObj = status.getScopes();
    if (scopesObj != null) {
        List scopes = Arrays.asList(scopesObj.getPlaceIds());
        result.setScopes(scopes);
    }
    return result;
}

From source file:com.twitstreet.db.data.Stock.java

License:Open Source License

public Stock(twitter4j.User twUser) {
    this.setId(twUser.getId());
    this.setLongName(twUser.getName());
    this.setName(twUser.getScreenName());
    this.setTotal(twUser.getFollowersCount());
    this.setPictureUrl(twUser.getProfileImageURL().toExternalForm());
    this.setSold(0.0D);
    this.setVerified(twUser.isVerified());
    this.setLanguage(twUser.getLang());
    this.setCreatedAt(twUser.getCreatedAt());
    this.setLocation(twUser.getLocation());
    this.setDescription(twUser.getDescription());
}