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

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

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

Status.isRetweet介绍

暂无

代码示例

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

theMap.put("retweet", status.isRetweet());
if (status.isRetweet()) {
 Status original = status.getRetweetedStatus();
 theMap.put("retweet_count", original.getRetweetCount());

代码示例来源:origin: Tristan971/Lyrebird

/**
 * Determines whether a given tweet is a retweet made by the current user. Twitter's API really is unhelpful on this
 * side so we mostly take an educated guess here, although it should be enough in most cases.
 *
 * @param status the tweet to test against
 *
 * @return true if and only if the given status is a retweet made by the current user
 */
public boolean isRetweetByCurrentUser(final Status status) {
  if (status.isRetweet()) {
    final Status retweetedStatus = status.getRetweetedStatus();
    return retweetedStatus.isRetweeted() ||
        retweetedStatus.isRetweetedByMe() ||
        sessionManager.isCurrentUser(status.getUser());
  } else {
    return false;
  }
}

代码示例来源:origin: Tristan971/Lyrebird

@Override
public void initialize() {
  setUpInteractionActions();
  targetStatus.addListener((o, prev, cur) -> {
    updateRetweetVisual(cur.isRetweet() ? cur.getRetweetedStatus().isRetweeted() : cur.isRetweeted());
    updateLikeVisual(cur.isFavorited());
  });
}

代码示例来源:origin: google/data-transfer-project

for (Status status : statuses) {
 boolean hasMedia = status.getMediaEntities().length > 0;
 if (hasMedia && !status.isRetweet()) {
  for (MediaEntity mediaEntity : status.getMediaEntities()) {
   photos.add(

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

.put("Retweeted", status.isRetweeted())
.put("FavoriteCount", status.getFavoriteCount())
.put("Retweet", status.isRetweet())
.put("RetweetCount", status.getRetweetCount())
.put("RetweetedByMe", status.isRetweetedByMe())

代码示例来源:origin: Tristan971/Lyrebird

/**
 * Checks whether a given tweet has been retweeted by the current user.
 * <p>
 * PSA : I don't care that you can retweet your own tweets. This is stupid and you should never do it. Will never
 * allow a PR "fixing" that pass.
 *
 * @param tweet the tweet to check
 *
 * @return Whether the given tweet had not yet been retweeted by the current user.
 */
public boolean notYetRetweeted(final Status tweet) {
  return !sessionManager.doWithCurrentTwitter(twitter -> {
    final Status updatedTweet = twitter.showStatus(tweet.getId());
    final Status originalStatus = updatedTweet.isRetweet() ? updatedTweet.getRetweetedStatus() : updatedTweet;
    return originalStatus.isRetweeted();
  }).get();
}

代码示例来源: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: stackoverflow.com

ResponseList<Status> tweets = twitter.getHomeTimeline();    
for(Status s : tweets){
  Tweet temp;
  if(s.isRetweet()){
    temp = new Tweet(s.getRetweetedStatus(),s.getUser().getName());
  }
  else{
    temp = new Tweet(s);
  }
  tweetsPanel.add(temp);
  tweetsPanel.add(Box.createRigidArea(new Dimension(0,2)));
}

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

theMap.put("retweet", status.isRetweet());
if (status.isRetweet()) {
 Status original = status.getRetweetedStatus();
 theMap.put("retweet_count", original.getRetweetCount());

代码示例来源:origin: Tristan971/Lyrebird

/**
 * @param newValue The status to prepare displaying for.
 */
@Override
public void updateWithValue(final Status newValue) {
  if (newValue == null || this.currentStatus.getValue() == newValue) {
    return;
  }
  this.currentStatus.setValue(newValue);
  this.isRetweet.set(currentStatus.getValue().isRetweet());
  authorProfilePicture.setImage(GENERAL_USER_AVATAR_DARK.getImage());
  if (currentStatus.getValue().isRetweet()) {
    handleRetweet(currentStatus.getValue());
  } else {
    setStatusDisplay(currentStatus.getValue());
  }
}

代码示例来源:origin: twitter/GraphJet

long userId = status.getUser().getId();
long tweetId = status.getId();
long resolvedTweetId = status.isRetweet() ? status.getRetweetedStatus().getId() : status.getId();
HashtagEntity[] hashtagEntities = status.getHashtagEntities();

代码示例来源:origin: Tristan971/Lyrebird

/**
 * Unretweets (deletes the retweet-created tweet for the current user. See {@link #retweet(Status)} for explanation
 * on that).
 *
 * @param tweet the tweet to unretweet
 *
 * @return The retweet that was deleted
 */
Status unretweet(final Status tweet) {
  final Status original = tweet.isRetweet() ? tweet.getRetweetedStatus() : tweet;
  return sessionManager.doWithCurrentTwitter(
      twitter -> twitter.unRetweetStatus(original.getId())
  ).onSuccess(resultingStatus -> LOG.debug(
      "User {} unretweeted tweet {}",
      getCurrentScreenName(),
      resultingStatus.getId()
  )).onFailure(err -> displayExceptionPane(
      "Could not unretweet tweet!",
      err.getMessage(),
      err
  )).get();
}

代码示例来源:origin: Tristan971/Lyrebird

/**
 * Called on click of the retweet button.
 * <p>
 * Will call {@link #updateRetweetVisual(boolean)} on task finish to set the appropriate visual value.
 *
 * @see TwitterInteractionService
 * @see TwitterBinaryInteraction
 * @see StatusInteraction#RETWEET
 */
private void onRetweet() {
  LOG.debug("Retweet interaction on status {}", targetStatus.getValue().getId());
  retweetButton.setDisable(true);
  CompletableFuture.supplyAsync(
      () -> interactionService.interact(targetStatus.getValue(), RETWEET)
  ).thenAcceptAsync(res -> {
    final Status originalStatus = targetStatus.getValue().isRetweet() ?
                   targetStatus.getValue().getRetweetedStatus() :
                   targetStatus.getValue();
    updateRetweetVisual(!interactionService.notYetRetweeted(originalStatus));
    retweetButton.setDisable(false);
  }, Platform::runLater);
}

代码示例来源:origin: rjyo/twitter-2-weibo

log.info(String.format("@%s - %s", name, statusText));
try {
  if (status.isRetweet()) {
    if (user.isDropRetweets()) {
      user.setLatestId(status.getId());

代码示例来源: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;
}

相关文章