List of usage examples for twitter4j Status getGeoLocation
GeoLocation getGeoLocation();
From source file:org.hubiquitus.hubotsdk.adapters.HTwitterAdapterInbox.java
License:Open Source License
/** * Function for transforming Tweet to HMessage * @param tweet from twitter4j/*from w ww. j a va 2s . c om*/ * @return HMessage of type hTweet */ private HMessage transformtweet(Status tweet) { HMessage message = new HMessage(); HTweet htweet = new HTweet(); if (("complete").equalsIgnoreCase(content)) { HTweetAuthor hauthortweet = new HTweetAuthor(); //Construct the location HLocation location = new HLocation(); if (tweet.getGeoLocation() != null) { HGeo geo = new HGeo(tweet.getGeoLocation().getLatitude(), tweet.getGeoLocation().getLongitude()); location.setPos(geo); message.setLocation(location); } //Construct the Place if (tweet.getPlace() != null) { if (tweet.getPlace().getStreetAddress() != null) { location.setAddr(tweet.getPlace().getStreetAddress()); } if (tweet.getPlace().getCountryCode() != null) { location.setCountryCode(tweet.getPlace().getCountryCode()); } if ((tweet.getPlace().getPlaceType() != null) && ("city".equalsIgnoreCase(tweet.getPlace().getPlaceType()))) { location.setCity(tweet.getPlace().getName()); } } //Construct the Authortweet JSONObject hauthortweet.setStatus(tweet.getUser().getStatusesCount()); hauthortweet.setFollowers(tweet.getUser().getFollowersCount()); hauthortweet.setFriends(tweet.getUser().getFriendsCount()); hauthortweet.setLocation(tweet.getUser().getLocation()); hauthortweet.setDescription(tweet.getUser().getDescription()); hauthortweet.setProfileImg(tweet.getUser().getProfileImageURL().toString()); hauthortweet.setUrl(tweet.getUser().getURL()); hauthortweet.setCreatedAt(tweet.getUser().getCreatedAt()); hauthortweet.setLang(tweet.getUser().getLang()); hauthortweet.setListeds(tweet.getUser().getListedCount()); hauthortweet.setGeo(tweet.getUser().isGeoEnabled()); hauthortweet.setVerified(tweet.getUser().isVerified()); hauthortweet.setName(tweet.getUser().getName()); //Construct the tweet JSONObject htweet.setId(tweet.getId()); try { htweet.setSource(tweet.getSource()); htweet.setAuthor(hauthortweet); } catch (MissingAttrException e) { log.error("message: ", e); } } // now manage the minimal list of attributes to get from twitter try { htweet.setText(tweet.getText()); } catch (MissingAttrException e) { log.error("message: ", e); } message.setPayload(htweet); message.setType("hTweet"); message.setAuthor(tweet.getUser().getScreenName() + "@twitter.com"); Date createdAt = tweet.getCreatedAt(); message.setPublished(createdAt); if (log.isDebugEnabled()) { log.debug("tweet(" + tweet + ") -> hMessage :" + message); } return message; }
From source file:org.mariotaku.twidere.model.ParcelableStatus.java
License:Open Source License
public ParcelableStatus(final Status orig, final long account_id, final boolean is_gap) { this.is_gap = is_gap; this.account_id = account_id; id = orig.getId();/*from www .jav a 2 s .c om*/ timestamp = getTime(orig.getCreatedAt()); final Status retweeted = orig.getRetweetedStatus(); final User retweet_user = retweeted != null ? orig.getUser() : null; is_retweet = orig.isRetweet(); retweet_id = retweeted != null ? retweeted.getId() : -1; retweet_timestamp = retweeted != null ? getTime(retweeted.getCreatedAt()) : -1; retweeted_by_user_id = retweet_user != null ? retweet_user.getId() : -1; retweeted_by_user_name = retweet_user != null ? retweet_user.getName() : null; retweeted_by_user_screen_name = retweet_user != null ? retweet_user.getScreenName() : null; retweeted_by_user_profile_image = retweet_user != null ? retweet_user.getProfileImageUrlHttps() : null; final Status quoted = orig.getQuotedStatus(); final User quote_user = quoted != null ? orig.getUser() : null; is_quote = orig.isQuote(); quote_id = quoted != null ? quoted.getId() : -1; quote_text_html = TwitterContentUtils.formatStatusText(orig); quote_text_plain = orig.getText(); quote_text_unescaped = HtmlEscapeHelper.toPlainText(quote_text_html); quote_timestamp = orig.getCreatedAt().getTime(); quote_source = orig.getSource(); quoted_by_user_id = quote_user != null ? quote_user.getId() : -1; quoted_by_user_name = quote_user != null ? quote_user.getName() : null; quoted_by_user_screen_name = quote_user != null ? quote_user.getScreenName() : null; quoted_by_user_profile_image = quote_user != null ? quote_user.getProfileImageUrlHttps() : null; quoted_by_user_is_protected = quote_user != null && quote_user.isProtected(); quoted_by_user_is_verified = quote_user != null && quote_user.isVerified(); final Status status; if (quoted != null) { status = quoted; } else if (retweeted != null) { status = retweeted; } else { status = orig; } final User user = status.getUser(); user_id = user.getId(); user_name = user.getName(); user_screen_name = user.getScreenName(); user_profile_image_url = user.getProfileImageUrlHttps(); user_is_protected = user.isProtected(); user_is_verified = user.isVerified(); user_is_following = user.isFollowing(); text_html = TwitterContentUtils.formatStatusText(status); media = ParcelableMedia.fromStatus(status); quote_media = quoted != null ? ParcelableMedia.fromStatus(orig) : null; text_plain = status.getText(); retweet_count = status.getRetweetCount(); favorite_count = status.getFavoriteCount(); reply_count = status.getReplyCount(); descendent_reply_count = status.getDescendentReplyCount(); in_reply_to_name = TwitterContentUtils.getInReplyToName(retweeted != null ? retweeted : orig); in_reply_to_screen_name = (retweeted != null ? retweeted : orig).getInReplyToScreenName(); in_reply_to_status_id = (retweeted != null ? retweeted : orig).getInReplyToStatusId(); in_reply_to_user_id = (retweeted != null ? retweeted : orig).getInReplyToUserId(); source = status.getSource(); location = ParcelableLocation.fromGeoLocation(status.getGeoLocation()); is_favorite = status.isFavorited(); text_unescaped = HtmlEscapeHelper.toPlainText(text_html); my_retweet_id = retweeted_by_user_id == account_id ? id : status.getCurrentUserRetweet(); is_possibly_sensitive = status.isPossiblySensitive(); mentions = ParcelableUserMention.fromUserMentionEntities(status.getUserMentionEntities()); card = ParcelableCardEntity.fromCardEntity(status.getCard(), account_id); place_full_name = getPlaceFullName(status.getPlace()); card_name = card != null ? card.name : null; }
From source file:org.mariotaku.twidere.util.ContentValuesCreator.java
License:Open Source License
@NonNull public static ContentValues createStatus(final Status orig, final long accountId) { if (orig == null) throw new NullPointerException(); final ContentValues values = new ContentValues(); values.put(Statuses.ACCOUNT_ID, accountId); values.put(Statuses.STATUS_ID, orig.getId()); values.put(Statuses.STATUS_TIMESTAMP, orig.getCreatedAt().getTime()); final Status status; if (orig.isRetweet()) { final Status retweetedStatus = orig.getRetweetedStatus(); final User retweetUser = orig.getUser(); final long retweetedById = retweetUser.getId(); values.put(Statuses.RETWEET_ID, retweetedStatus.getId()); values.put(Statuses.RETWEET_TIMESTAMP, retweetedStatus.getCreatedAt().getTime()); values.put(Statuses.RETWEETED_BY_USER_ID, retweetedById); values.put(Statuses.RETWEETED_BY_USER_NAME, retweetUser.getName()); values.put(Statuses.RETWEETED_BY_USER_SCREEN_NAME, retweetUser.getScreenName()); values.put(Statuses.RETWEETED_BY_USER_PROFILE_IMAGE, (retweetUser.getProfileImageUrlHttps())); values.put(Statuses.IS_RETWEET, true); if (retweetedById == accountId) { values.put(Statuses.MY_RETWEET_ID, orig.getId()); } else {//from w ww . java 2 s . co m values.put(Statuses.MY_RETWEET_ID, orig.getCurrentUserRetweet()); } status = retweetedStatus; } else if (orig.isQuote()) { final Status quotedStatus = orig.getQuotedStatus(); final User quoteUser = orig.getUser(); final long quotedById = quoteUser.getId(); values.put(Statuses.QUOTE_ID, quotedStatus.getId()); final String textHtml = TwitterContentUtils.formatStatusText(orig); values.put(Statuses.QUOTE_TEXT_HTML, textHtml); values.put(Statuses.QUOTE_TEXT_PLAIN, orig.getText()); values.put(Statuses.QUOTE_TEXT_UNESCAPED, toPlainText(textHtml)); values.put(Statuses.QUOTE_TIMESTAMP, orig.getCreatedAt().getTime()); values.put(Statuses.QUOTE_SOURCE, orig.getSource()); final ParcelableMedia[] quoteMedia = ParcelableMedia.fromStatus(orig); if (quoteMedia != null && quoteMedia.length > 0) { try { values.put(Statuses.QUOTE_MEDIA_JSON, LoganSquare.serialize(Arrays.asList(quoteMedia), ParcelableMedia.class)); } catch (IOException ignored) { } } values.put(Statuses.QUOTED_BY_USER_ID, quotedById); values.put(Statuses.QUOTED_BY_USER_NAME, quoteUser.getName()); values.put(Statuses.QUOTED_BY_USER_SCREEN_NAME, quoteUser.getScreenName()); values.put(Statuses.QUOTED_BY_USER_PROFILE_IMAGE, quoteUser.getProfileImageUrlHttps()); values.put(Statuses.QUOTED_BY_USER_IS_VERIFIED, quoteUser.isVerified()); values.put(Statuses.QUOTED_BY_USER_IS_PROTECTED, quoteUser.isProtected()); values.put(Statuses.IS_QUOTE, true); status = quotedStatus; } else { values.put(Statuses.MY_RETWEET_ID, orig.getCurrentUserRetweet()); status = orig; } if (orig.isRetweet()) { values.put(Statuses.IN_REPLY_TO_STATUS_ID, status.getInReplyToStatusId()); values.put(Statuses.IN_REPLY_TO_USER_ID, status.getInReplyToUserId()); values.put(Statuses.IN_REPLY_TO_USER_NAME, TwitterContentUtils.getInReplyToName(status)); values.put(Statuses.IN_REPLY_TO_USER_SCREEN_NAME, status.getInReplyToScreenName()); } else { values.put(Statuses.IN_REPLY_TO_STATUS_ID, orig.getInReplyToStatusId()); values.put(Statuses.IN_REPLY_TO_USER_ID, orig.getInReplyToUserId()); values.put(Statuses.IN_REPLY_TO_USER_NAME, TwitterContentUtils.getInReplyToName(orig)); values.put(Statuses.IN_REPLY_TO_USER_SCREEN_NAME, orig.getInReplyToScreenName()); } final User user = status.getUser(); final long userId = user.getId(); final String profileImageUrl = (user.getProfileImageUrlHttps()); final String name = user.getName(), screenName = user.getScreenName(); values.put(Statuses.USER_ID, userId); values.put(Statuses.USER_NAME, name); values.put(Statuses.USER_SCREEN_NAME, screenName); values.put(Statuses.IS_PROTECTED, user.isProtected()); values.put(Statuses.IS_VERIFIED, user.isVerified()); values.put(Statuses.USER_PROFILE_IMAGE_URL, profileImageUrl); values.put(CachedUsers.IS_FOLLOWING, user.isFollowing()); final String textHtml = TwitterContentUtils.formatStatusText(status); values.put(Statuses.TEXT_HTML, textHtml); values.put(Statuses.TEXT_PLAIN, status.getText()); values.put(Statuses.TEXT_UNESCAPED, toPlainText(textHtml)); values.put(Statuses.RETWEET_COUNT, status.getRetweetCount()); values.put(Statuses.REPLY_COUNT, status.getReplyCount()); values.put(Statuses.FAVORITE_COUNT, status.getFavoriteCount()); values.put(Statuses.DESCENDENT_REPLY_COUNT, status.getDescendentReplyCount()); values.put(Statuses.SOURCE, status.getSource()); values.put(Statuses.IS_POSSIBLY_SENSITIVE, status.isPossiblySensitive()); final GeoLocation location = status.getGeoLocation(); if (location != null) { values.put(Statuses.LOCATION, ParcelableLocation.toString(location.getLatitude(), location.getLongitude())); } final Place place = status.getPlace(); if (place != null) { values.put(Statuses.PLACE_FULL_NAME, place.getFullName()); } values.put(Statuses.IS_FAVORITE, status.isFavorited()); final ParcelableMedia[] media = ParcelableMedia.fromStatus(status); if (media != null && media.length > 0) { try { values.put(Statuses.MEDIA_JSON, LoganSquare.serialize(Arrays.asList(media), ParcelableMedia.class)); } catch (IOException ignored) { } } final ParcelableUserMention[] mentions = ParcelableUserMention.fromStatus(status); if (mentions != null && mentions.length > 0) { try { values.put(Statuses.MENTIONS_JSON, LoganSquare.serialize(Arrays.asList(mentions), ParcelableUserMention.class)); } catch (IOException ignored) { } } final ParcelableCardEntity card = ParcelableCardEntity.fromCardEntity(status.getCard(), accountId); if (card != null) { try { values.put(Statuses.CARD, LoganSquare.serialize(card)); values.put(Statuses.CARD_NAME, card.name); } catch (IOException ignored) { } } return values; }
From source file:org.mixare.utils.TwitterClient.java
License:Open Source License
/** * Query the twitter search API using oAuth 2.0 * @return//from w w w . j a v a 2 s .co m */ public static String queryData() { ConfigurationBuilder cb = new ConfigurationBuilder(); //to be configured in a properties... cb.setDebugEnabled(true).setOAuthConsumerKey("mt10dv6tTKacqlm14lw5w") .setOAuthConsumerSecret("4kRV1E1XIU3kj4JQj2R5LE1yct0RRaRl9sB5PpPrB0") .setOAuthAccessToken("390019380-IQ5VdvUKvxY9JOsTToEU8ElCabebc76H9X2g3QX4") .setOAuthAccessTokenSecret("ghJn4LTfDr7uHUCsbt6ycmpeVTwwpa3hZnXyEjyZvs"); cb.setJSONStoreEnabled(true); TwitterFactory tf = new TwitterFactory(cb.build()); Twitter twitter = tf.getInstance(); Query query = new Query(); query = query.geoCode(new GeoLocation(lat, lon), rad, Query.KILOMETERS); String jsonArrayAsString = "{\"results\":[";//start try { QueryResult result = twitter.search(query); int size = 0; for (Status status : result.getTweets()) { { if (status.getGeoLocation() != null) { String jsonSingleObject = DataObjectFactory.getRawJSON(status); if (size == 0) jsonArrayAsString += jsonSingleObject; else jsonArrayAsString += "," + jsonSingleObject; size++; } } } jsonArrayAsString += "]}";//close array return jsonArrayAsString; } catch (Exception e) { Log.e(Config.TAG, "Error querying twitter data :" + e); e.printStackTrace(); } return null; }
From source file:org.n52.twitter.model.TwitterMessage.java
License:Open Source License
public static TwitterMessage create(Status tweet) { if (isGeolocated(tweet)) { TwitterMessage result = new TwitterMessage(); result.id = Long.toString(tweet.getId()); result.procedure = new Procedure(tweet.getUser().getScreenName(), String.format(USER_URL, tweet.getUser().getScreenName())); result.location = new TwitterLocation(tweet.getGeoLocation(), tweet.getPlace()); result.createdTime = new DateTime(tweet.getCreatedAt(), DateTimeZone.UTC); result.link = String.format(TWEET_URL, tweet.getUser().getScreenName(), Long.toString(tweet.getId())); result.message = tweet.getText(); return result; }/*from ww w.ja v a 2 s.c om*/ return null; }
From source file:org.n52.twitter.model.TwitterMessage.java
License:Open Source License
private static boolean isGeolocated(Status status) { return status.getGeoLocation() != null && status.getPlace() != null && (status.getPlace().getBoundingBoxCoordinates() != null || status.getPlace().getGeometryCoordinates() != null) && status.getPlace().getId() != null && !status.getPlace().getId().isEmpty() && status.getPlace().getName() != null && !status.getPlace().getName().isEmpty(); }
From source file:org.nosceon.titanite.examples.TweetEventSource.java
License:Apache License
@Override protected void onSubscribe(String id) { if (stream == null) { stream = new TwitterStreamFactory().getInstance(); stream.addListener(new StatusAdapter() { @Override/*from ww w . ja v a 2 s.com*/ public void onStatus(Status status) { GeoLocation location = status.getGeoLocation(); if (location != null) { send("{ \"lat\" : " + location.getLatitude() + ", \"lng\" : " + location.getLongitude() + " }"); } } }); stream.filter(new FilterQuery().locations(RANGE)); } }
From source file:org.selman.tweetamo.PersistentStore.java
License:Apache License
private static Map<String, AttributeValue> newItem(Status status) { Map<String, AttributeValue> item = new HashMap<String, AttributeValue>(); item.put(COL_ID, new AttributeValue().withN(Long.toString(status.getId()))); item.put(COL_CREATEDAT, new AttributeValue().withN(Long.toString(status.getCreatedAt().getTime()))); if (status.getGeoLocation() != null) { item.put(COL_LAT, new AttributeValue().withN(Double.toString(status.getGeoLocation().getLatitude()))); item.put(COL_LONG, new AttributeValue().withN(Double.toString(status.getGeoLocation().getLongitude()))); }//w w w .ja va 2s . c o m item.put(COL_SCREENNAME, new AttributeValue().withS(status.getUser().getScreenName())); item.put(COL_TEXT, new AttributeValue().withS(status.getText())); return item; }
From source file:org.smarttechie.servlet.SimpleStream.java
public void getStream(TwitterStream twitterStream, String[] parametros, final Session session)//,PrintStream out) { listener = new StatusListener() { @Override/*w ww .j av a2 s.c om*/ public void onException(Exception arg0) { // TODO Auto-generated method stub } @Override public void onDeletionNotice(StatusDeletionNotice arg0) { // TODO Auto-generated method stub } @Override public void onScrubGeo(long arg0, long arg1) { // TODO Auto-generated method stub } @Override public void onStatus(Status status) { Twitter twitter = new TwitterFactory().getInstance(); User user = status.getUser(); // gets Username String username = status.getUser().getScreenName(); System.out.println(""); String profileLocation = user.getLocation(); System.out.println(profileLocation); long tweetId = status.getId(); System.out.println(tweetId); String content = status.getText(); System.out.println(content + "\n"); JSONObject obj = new JSONObject(); obj.put("User", status.getUser().getScreenName()); obj.put("ProfileLocation", user.getLocation().replaceAll("'", "''")); obj.put("Id", status.getId()); obj.put("UserId", status.getUser().getId()); //obj.put("User", status.getUser()); obj.put("Message", status.getText().replaceAll("'", "''")); obj.put("CreatedAt", status.getCreatedAt().toString()); obj.put("CurrentUserRetweetId", status.getCurrentUserRetweetId()); //Get user retweeteed String otheruser; try { if (status.getCurrentUserRetweetId() != -1) { User user2 = twitter.showUser(status.getCurrentUserRetweetId()); otheruser = user2.getScreenName(); System.out.println("Other user: " + otheruser); } } catch (Exception ex) { System.out.println("ERROR: " + ex.getMessage().toString()); } obj.put("IsRetweet", status.isRetweet()); obj.put("IsRetweeted", status.isRetweeted()); obj.put("IsFavorited", status.isFavorited()); obj.put("InReplyToUserId", status.getInReplyToUserId()); //In reply to obj.put("InReplyToScreenName", status.getInReplyToScreenName()); obj.put("RetweetCount", status.getRetweetCount()); if (status.getGeoLocation() != null) { obj.put("GeoLocationLatitude", status.getGeoLocation().getLatitude()); obj.put("GeoLocationLongitude", status.getGeoLocation().getLongitude()); } JSONArray listHashtags = new JSONArray(); String hashtags = ""; for (HashtagEntity entity : status.getHashtagEntities()) { listHashtags.add(entity.getText()); hashtags += entity.getText() + ","; } if (!hashtags.isEmpty()) obj.put("HashtagEntities", hashtags.substring(0, hashtags.length() - 1)); if (status.getPlace() != null) { obj.put("PlaceCountry", status.getPlace().getCountry()); obj.put("PlaceFullName", status.getPlace().getFullName()); } obj.put("Source", status.getSource()); obj.put("IsPossiblySensitive", status.isPossiblySensitive()); obj.put("IsTruncated", status.isTruncated()); if (status.getScopes() != null) { JSONArray listScopes = new JSONArray(); String scopes = ""; for (String scope : status.getScopes().getPlaceIds()) { listScopes.add(scope); scopes += scope + ","; } if (!scopes.isEmpty()) obj.put("Scopes", scopes.substring(0, scopes.length() - 1)); } obj.put("QuotedStatusId", status.getQuotedStatusId()); JSONArray list = new JSONArray(); String contributors = ""; for (long id : status.getContributors()) { list.add(id); contributors += id + ","; } if (!contributors.isEmpty()) obj.put("Contributors", contributors.substring(0, contributors.length() - 1)); System.out.println("" + obj.toJSONString()); insertNodeNeo4j(obj); //out.println(obj.toJSONString()); String statement = "INSERT INTO TweetsClassification JSON '" + obj.toJSONString() + "';"; executeQuery(session, statement); } @Override public void onTrackLimitationNotice(int arg0) { // TODO Auto-generated method stub } @Override public void onStallWarning(StallWarning sw) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }; FilterQuery fq = new FilterQuery(); fq.track(parametros); twitterStream.addListener(listener); twitterStream.filter(fq); }
From source file:org.sociotech.communitymashup.source.twitter.TwitterSourceService.java
License:Open Source License
/** * Creates a content for the given tweet, adds it to the data set and sets * the author./*from ww w.j av a 2 s . co m*/ * * @param author * Person corresponding to the twitter user which authored the * tweet * @param tweet * The tweet * @return The Content created from the tweet, null in error case. */ private Content createContentFromTweet(Person author, Status tweet) { if (tweet == null) { return null; } String tweetText = tweet.getText(); if (tweetText == null || tweetText.isEmpty()) { return null; } String ident = tweet.getId() + ""; if (this.getContentWithSourceIdent(ident) != null) { // status already created return null; } Content tweetContent = factory.createContent(); tweetContent.setStringValue(tweetText); tweetContent.setName(createTitleFromTwitterText(tweetText)); tweetContent = (Content) this.add(tweetContent, ident); if (tweetContent == null) { return null; } tweetContent.metaTag(TwitterTags.TWITTER); tweetContent.setCreated(tweet.getCreatedAt()); if (author != null) { tweetContent.setAuthor(author); } // and tag the status HashtagEntity[] hashtags = tweet.getHashtagEntities(); tagIOwithHashtags(tweetContent, hashtags); UserMentionEntity[] mentionedUsers = tweet.getUserMentionEntities(); if (mentionedUsers != null && mentionedUsers.length > 0 && source.isPropertyTrue(TwitterProperties.ADD_MENTIONED_PEOPLE_PROPERTY)) { for (int i = 0; i < mentionedUsers.length; i++) { Person mentionedPerson = getPersonForTwitterUserId(mentionedUsers[i].getId()); if (mentionedPerson == null) { continue; } tweetContent.addContributor(mentionedPerson); } } URLEntity[] urlEntities = tweet.getURLEntities(); if (urlEntities != null && urlEntities.length > 0 && source.isPropertyTrue(TwitterProperties.ADD_URL_ENTITIES_PROPERTY)) { for (int i = 0; i < urlEntities.length; i++) { String url = urlEntities[i].getURL(); if (url != null) { // attach url as website tweetContent.addWebSite(url); } } } // no more available // String language = tweet.getIsoLanguageCode(); // if(language != null && !language.isEmpty()) // { // // set in content // tweetContent.setLocale(language); // // set as meta tag // tweetContent.metaTag(language); // } // TODO check media entities // MediaEntity[] mediaEntities = twitterStatus.getMediaEntities(); // add location GeoLocation tweetLocation = tweet.getGeoLocation(); Place place = tweet.getPlace(); if (tweetLocation != null || place != null) { Location location = factory.createLocation(); if (place != null) { location.setStreet(place.getStreetAddress()); location.setCountry(place.getCountry()); location.setStringValue(place.getFullName()); } if (tweetLocation != null) { location.setLatitude(tweetLocation.getLatitude() + ""); location.setLongitude(tweetLocation.getLongitude() + ""); } location = (Location) this.add(location, "tloc_" + tweet.getId()); if (location != null) { location.metaTag(TwitterTags.TWITTER); tweetContent.extend(location); if (place != null) { location.metaTag(place.getCountryCode()); location.metaTag(place.getPlaceType()); } } } return tweetContent; }