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

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

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

Status.getUserMentionEntities介绍

暂无

代码示例

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

public void onStatus(Status status){
 for(UserMentionEntity mention : status.getUserMentionEntities()){
  if(mention.getScreenName().equals("yusuke")){
   // do whatever you want
   break;
  }
 }
}

代码示例来源:origin: eshioji/trident-tutorial

private void extractMentionedAccounts(Status tweet, Set<Content> contents) {
  for (UserMentionEntity entity : tweet.getUserMentionEntities()) {
    Content mentionedUser = newBase(tweet);
    mentionedUser.setContentName(String.valueOf(entity.getId()));
    mentionedUser.setContentType("account_mentioned");
    contents.add(mentionedUser);
  }
}

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

/**
 * In case this is a reply we pre-fill the content field with the appropriate mentions.
 */
private void prefillMentionsForReply() {
  final User currentUser = sessionManager.currentSessionProperty().getValue().getTwitterUser().get();
  final Status replied = inReplyStatus.getValue();
  final StringBuilder prefillText = new StringBuilder();
  prefillText.append('@').append(replied.getUser().getScreenName());
  Arrays.stream(replied.getUserMentionEntities())
     .map(UserMentionEntity::getScreenName)
     .filter(username -> !username.equals(currentUser.getScreenName()))
     .forEach(username -> prefillText.append(' ').append('@').append(username));
  prefillText.append(' ');
  final String prefill = prefillText.toString();
  tweetTextArea.setText(prefill);
  tweetTextArea.positionCaret(prefill.length());
}

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

@Override
public List<Token> extractTokens(final Status status) {
  return Arrays.stream(status.getUserMentionEntities()).map(mention -> new Token(
      "@" + mention.getText(),
      mention.getStart(),
      mention.getEnd(),
      Token.TokenType.CLICKABLE,
      () -> userDetailsService.openUserDetails(mention.getId())
  )).collect(Collectors.toList());
}

代码示例来源:origin: eshioji/trident-tutorial

if (tweet.getUserMentionEntities() != null) {
  extractMentionedAccounts(tweet, contents);

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

for (final UserMentionEntity user : this.status.getUserMentionEntities()) {
  final USMFStatus.User u = new USMFStatus.User();
  u.name = user.getScreenName();

代码示例来源:origin: org.openimaj/sandbox

for (final UserMentionEntity user : this.status.getUserMentionEntities()) {
  final USMFStatus.User u = new USMFStatus.User();
  u.name = user.getScreenName();

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

struct.put("UserMentionEntities", convert(status.getUserMentionEntities()));
struct.put("MediaEntities", convert(status.getMediaEntities()));
struct.put("SymbolEntities", convert(status.getSymbolEntities()));

相关文章