twitter4j.Status.getRetweetCount()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中twitter4j.Status.getRetweetCount()方法的一些代码示例,展示了Status.getRetweetCount()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Status.getRetweetCount()方法的具体详情如下:
包路径:twitter4j.Status
类名称:Status
方法名:getRetweetCount

Status.getRetweetCount介绍

[英]Returns the number of times this tweet has been retweeted, or -1 when the tweet was created before this feature was enabled.
[中]返回此推文被转发的次数,或在启用此功能之前创建推文时返回-1。

代码示例

代码示例来源:origin: apache/incubator-druid

theMap.put("retweet_count", original.getRetweetCount());

代码示例来源:origin: apache/flume

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;
}

代码示例来源:origin: FutureCitiesCatapult/TomboloDigitalConnector

@Override
  public String getValue() {
    return status.getRetweetCount() + "";
  }
},

代码示例来源:origin: stackoverflow.com

private boolean retweetedAlready(Status status) throws TwitterException {
   if(status.isRetweetedByMe() && status.getRetweetCount() > 1 ){
   return true; // this twit retweeted by your and others
 } else if(status.isRetweetedByMe() && status.getRetweetCount() == 1 )
   return  true; // this twit only retweeted by your
 }else{
   return false; // this twit not retweeted by your but mybe others retweeted
 }

代码示例来源:origin: stackoverflow.com

long userId = 0000000L;
  try 
  {
   ResponseList<Status> statusList = twitterObj.timelines().getUserTimeline(userId);
   for (Status statusItem : statusList)
   {
    System.out.println("Tweet Id : " + statusItem.getId() + ", retweet count: " + statusItem.getRetweetCount());
   }               
  } 
  catch (TwitterException ex) 
  {
   // Do error handling things here
  }

代码示例来源:origin: stackoverflow.com

List<Map<String, String>> tweetList = new LinkedList<Map<String, String>>();
for (Status tweet : tweets) {
  Map<String, String> tweetResult = new LinkedHashMap<String, String>();
  tweetResult.put("username", tweet.getUser().getScreenName());
  tweetResult.put("status", tweet.getText());
  tweetResult.put("date", tweet.getCreatedAt().toString());
  tweetResult.put("retweets", String.valueOf(tweet.getRetweetCount()));
  tweetList.add(tweetResult);
}
String resultJson = new Gson().toJson(tweetList);
response.getWriter().write(resultJson);

代码示例来源:origin: stackoverflow.com

for (Status status : result.getTweets()) 
   {
     System.out.println("RT "+status.getRetweetCount());
     System.out.println("FAV "+status.getFavoriteCount());
     sb.append(status.getText()+"\n");
   }

代码示例来源:origin: arcturus/android-live-storm

@Override
public List<Object> filter(Status original) {
    Status status = original.getRetweetedStatus();
    if (status == null) {
      return null;
    }
      if(status.getRetweetCount() < retweetCount) {
    return null;
  }
  
  //Just tweets two days old
  if(status.getCreatedAt().getTime() + 2*24*60*60*1000 < System.currentTimeMillis()) {
    return null;
  }
  
  JSONObject msg = new JSONObject();
  msg.put("user", original.getUser().getScreenName());
  msg.put("photo", original.getUser().getProfileImageURL().toString());
  msg.put("tweet", original.getText());
  msg.put("id", original.getId());
  //msg.put("count", status.getRetweetCount() > 100 ? "> 100" : status.getRetweetCount());
      msg.put("count", status.getRetweetCount());
  
  publish(msg.toJSONString());        
  
  List<Object> result = new ArrayList<Object>();
  result.add(status);
  return result;
}

代码示例来源:origin: io.druid.extensions/druid-examples

theMap.put("retweet_count", original.getRetweetCount());

代码示例来源:origin: lumongo/lumongo

@Override
public void onStatus(Status status) {
  Document tweet = new Document();
  
  tweet.put("_id", status.getId());
  tweet.put("createdAt", status.getCreatedAt());
  tweet.put("favoriteCount", status.getFavoriteCount());
  tweet.put("retweetCount", status.getRetweetCount());
  if (status.getGeoLocation() != null) {
    tweet.put("lat", status.getGeoLocation().getLatitude());
    tweet.put("long", status.getGeoLocation().getLongitude());
  }
  tweet.put("screenName", status.getUser().getScreenName());
  if (status.getRetweetedStatus() != null) {
    tweet.put("retweetedStatus", status.getRetweetedStatus().getText());
  }
  
  tweet.put("text", status.getText());
  Document query = new Document();
  
  query.put("_id", status.getId());
  collection.replaceOne(query, tweet, new UpdateOptions().upsert(true));
}

代码示例来源:origin: org.apache.flume.flume-ng-sources/flume-twitter-source

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;
}

代码示例来源:origin: jcustenborder/kafka-connect-twitter

.put("FavoriteCount", status.getFavoriteCount())
.put("Retweet", status.isRetweet())
.put("RetweetCount", status.getRetweetCount())
.put("RetweetedByMe", status.isRetweetedByMe())
.put("CurrentUserRetweetId", status.getCurrentUserRetweetId())

相关文章