private Record extractRecord(String idPrefix, Schema avroSchema, Status status) { User user = status.getUser(); Record doc = new Record(avroSchema); doc.put("id", idPrefix + status.getId()); doc.put("created_at", formatterTo.format(status.getCreatedAt())); doc.put("retweet_count", status.getRetweetCount()); doc.put("retweeted", status.isRetweet()); doc.put("in_reply_to_user_id", status.getInReplyToUserId()); doc.put("in_reply_to_status_id", status.getInReplyToStatusId()); addString(doc, "source", status.getSource()); addString(doc, "text", status.getText()); MediaEntity[] mediaEntities = status.getMediaEntities(); if (mediaEntities.length > 0) { addString(doc, "media_url_https", mediaEntities[0].getMediaURLHttps()); addString(doc, "expanded_url", mediaEntities[0].getExpandedURL()); } doc.put("user_friends_count", user.getFriendsCount()); doc.put("user_statuses_count", user.getStatusesCount()); doc.put("user_followers_count", user.getFollowersCount()); addString(doc, "user_location", user.getLocation()); addString(doc, "user_description", user.getDescription()); addString(doc, "user_screen_name", user.getScreenName()); addString(doc, "user_name", user.getName()); return doc; }
private void extractRepliedAccount(Status tweet, Set<Content> contents) { long accountId = tweet.getInReplyToUserId(); if (accountId > 0) { Content replyStatus = newBase(tweet); replyStatus.setContentName(String.valueOf(accountId)); replyStatus.setContentType("reply_to_account"); contents.add(replyStatus); } }
public void onStatus(Status status) { System.out.println("onStatus @" + status.getUser().getScreenName() + " - "+ status.getText()); System.out.println(status.getInReplyToUserId()); Twitter tf = new TwitterFactory().getInstance(); StatusUpdate st = new StatusUpdate("hello"); st.inReplyToStatusId(status.getId()); try { tf.updateStatus(st); } catch (TwitterException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
@Override public void onStatus(Status status) { Language language = twitterIDs.get(status.getUser().getId()); if (twitterIDs.containsKey(status.getUser().getId()) && (status.getInReplyToScreenName() == null || twitterIDs.containsKey(status.getInReplyToUserId()))) for (TwitterFinder twitterFinder : TwitterFinder.getTwitterChannels().values()) try { IChannel chan = ClientConfig.DISCORD().getChannelByID(twitterFinder.getChannelId()); if (chan != null && Translator.getLanguageFrom(chan).equals(language)) Message.sendEmbed(chan, createEmbedFor(status)); } catch(Exception e){ Reporter.report(e, ClientConfig.DISCORD().getChannelByID(twitterFinder.getChannelId())); LOG.error("onStatus", e); } }
status.reply_to = new User(); status.reply_to.name = this.status.getInReplyToScreenName(); status.reply_to.id = this.status.getInReplyToUserId();
status.reply_to = new User(); status.reply_to.name = this.status.getInReplyToScreenName(); status.reply_to.id = this.status.getInReplyToUserId();
private Record extractRecord(String idPrefix, Schema avroSchema, Status status) { User user = status.getUser(); Record doc = new Record(avroSchema); doc.put("id", idPrefix + status.getId()); doc.put("created_at", formatterTo.format(status.getCreatedAt())); doc.put("retweet_count", status.getRetweetCount()); doc.put("retweeted", status.isRetweet()); doc.put("in_reply_to_user_id", status.getInReplyToUserId()); doc.put("in_reply_to_status_id", status.getInReplyToStatusId()); addString(doc, "source", status.getSource()); addString(doc, "text", status.getText()); MediaEntity[] mediaEntities = status.getMediaEntities(); if (mediaEntities.length > 0) { addString(doc, "media_url_https", mediaEntities[0].getMediaURLHttps()); addString(doc, "expanded_url", mediaEntities[0].getExpandedURL()); } doc.put("user_friends_count", user.getFriendsCount()); doc.put("user_statuses_count", user.getStatusesCount()); doc.put("user_followers_count", user.getFollowersCount()); addString(doc, "user_location", user.getLocation()); addString(doc, "user_description", user.getDescription()); addString(doc, "user_screen_name", user.getScreenName()); addString(doc, "user_name", user.getName()); return doc; }
.put("Truncated", status.isTruncated()) .put("InReplyToStatusId", status.getInReplyToStatusId()) .put("InReplyToUserId", status.getInReplyToUserId()) .put("InReplyToScreenName", status.getInReplyToScreenName()) .put("Favorited", status.isFavorited())