twitter4j.Twitter.showStatus()方法的使用及代码示例

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

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

Twitter.showStatus介绍

[英]Returns a single status, specified by the id parameter. The status's author will be returned inline.
This method calls http://twitter.com/statuses/show
[中]返回由id参数指定的单个状态。状态的作者将以内联方式返回。
此方法调用http://twitter.com/statuses/show

代码示例

代码示例来源:origin: net.homeip.yusuke/twitter4j

/**
 * Returns a single status, specified by the id parameter. The status's author will be returned inline.
 * <br>This method calls http://twitter.com/statuses/show
 *
 * @param id the numerical ID of the status you're trying to retrieve
 * @return a single status
 * @throws TwitterException when Twitter service or network is unavailable
 * @deprecated Use showStatus(long id) instead.
 * @see <a href="http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-statuses%C2%A0show">Twitter API Wiki / Twitter REST API Method: statuses show</a>
 */
public Status show(int id) throws TwitterException {
  return showStatus((long)id);
}

代码示例来源:origin: org.twitter4j/twitter4j-async

@Override
  public void invoke(List<TwitterListener> listeners) throws TwitterException {
    Status status = twitter.showStatus(id);
    for (TwitterListener listener : listeners) {
      try {
        listener.gotShowStatus(status);
      } catch (Exception e) {
        logger.warn("Exception at showStatus", e);
      }
    }
  }
});

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

ConfigurationBuilder cb = new ConfigurationBuilder();
 cb.setDebugEnabled(true)
   .setOAuthConsumerKey(TwitterConstantes.APIKEY)
   .setOAuthConsumerSecret(TwitterConstantes.APIKEYSECRET)
   .setOAuthAccessToken(TwitterConstantes.TOKEN)
   .setOAuthAccessTokenSecret(TwitterConstantes.TOKENSECRET);
 TwitterFactory tf = new TwitterFactory(cb.build());
 Twitter twitter = tf.getInstance();
 String tweetID ="652694439584993280";
 try {
   twitter4j.Status sts = twitter.showStatus(Long.parseLong(tweetID));
   ExtendedMediaEntity[] medias = sts.getExtendedMediaEntities(); //get the media entities from the status
   for(ExtendedMediaEntity m : medias){ //search trough your entities
     System.out.println("this is a pic","  " +m.getMediaURL());
   }
 } catch (TwitterException e) {
   e.printStackTrace();
 }

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

+ status.getText());
Status status = twitter.showStatus(81642112l);
System.out.println("------------------------------");
System.out.println("Showing " + status.getUser().getName()

代码示例来源:origin: org.mule.modules/mule-module-twitter

/**
 * Returns a single status, specified by the id parameter below. The status's
 * author will be returned inline. <br>
 * This method calls http://api.twitter.com/1.1/statuses/show
 * <p/>
 * {@sample.xml ../../../doc/twitter-connector.xml.sample twitter:showStatus}
 *
 * @param id the numerical ID of the status you're trying to retrieve
 * @return a single {@link Status}
 * @throws twitter4j.TwitterException when Twitter service or network is unavailable
 * @see <a href="http://dev.twitter.com/doc/get/statuses/show/:id">GET
 * statuses/show/:id | dev.twitter.com</a>
 */
@Processor
public Status showStatus(long id) throws TwitterException {
  return getConnectionManagement().getTwitterClient().showStatus(id);
}

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

/**
 * Returns whether or not the given tweet has not yet been liked and that thus the interaction with it should be to
 * like it.
 *
 * @param tweet the tweet to check
 *
 * @return true if the given tweet is not liked yet but the current user
 */
boolean notYetLiked(final Status tweet) {
  return !sessionManager.doWithCurrentTwitter(twitter -> twitter.showStatus(tweet.getId()).isFavorited())
             .get();
}

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

Status tweetById = twitter.showStatus(tweet.getId());
String url= "https://twitter.com/" + tweetById.getUser().getScreenName() 
    + "/status/" + tweetById.getId();

代码示例来源:origin: janpetryk/reddit-bot

@Override
public Tweet showStatus(Long id) throws TwitterApiException {
  try {
    Status status = twitter.showStatus(id);
    Tweet.Builder tweetBuilder = new Tweet.Builder()
        .body(status.getText())
        .datePosted(new DateTime(status.getCreatedAt()))
        .id(id)
        .poster(status.getUser().getScreenName());
    prepareEntities(status, tweetBuilder);
    return tweetBuilder.build();
  } catch (TwitterException e) {
    throw new TwitterApiException(e, e.exceededRateLimitation(),
        (e.getRateLimitStatus() != null && e.getRateLimitStatus().getSecondsUntilReset() > 0) ?
            e.getRateLimitStatus().getSecondsUntilReset() * 1000 : 0, e.getErrorCode());
  }
}

相关文章