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

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

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

Twitter.getId介绍

暂无

代码示例

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

try {
 String page = "" + pageNumber;
 long id = twitterApi.getId();
 monitor.debug(() -> format("Getting tweets for %s (page %s)", id, page));
 ResponseList<Status> statuses = twitterApi.getUserTimeline(id, paging);

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

Twitter twitter = (Twitter) request.getSession().getAttribute("twitter");
     long userID = twitter.getId();
     twitter4j.User newUser=twitter.showUser(twitter.getScreenName());
     String name=newUser.getName();

代码示例来源:origin: HuygensING/timbuctoo

@Override
public Optional<User> getUserFromAccessToken(String accessToken) throws UserValidationException {
 String token = accessToken.substring(0, accessToken.indexOf("_"));
 String tokenSecret = accessToken.substring(accessToken.indexOf("_") + 1, accessToken.length());
 if (users.get(token) != null) {
  return Optional.of(users.get(token));
 } else {
  twitter.setOAuthAccessToken(new AccessToken(token, tokenSecret));
  twitter4j.User userTwitter;
  try {
   userTwitter = twitter.showUser(Long.valueOf(twitter.getId()));
  } catch (TwitterException e) {
   return Optional.empty();
  }
  User user = User.create(userTwitter.getName(), userTwitter.getId() + "",
   userTwitter.getId() + "");
  users.put(token, user);
  return Optional.of(user);
 }
}

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

AccessToken a = new AccessToken(token,secret);
 Twitter twitter = new TwitterFactory().getInstance();
 twitter.setOAuthConsumer(Constants.CONSUMER_KEY, Constants.CONSUMER_SECRET);
 twitter.setOAuthAccessToken(a);
 int i=twitter.getId();
 User u=twitter.showUser(i);
 System.out.println("user name"+u.getName());

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

AccessToken a = new AccessToken(token,secret);
   Twitter twitter = new TwitterFactory().getInstance();
   twitter.setOAuthConsumer(Constants.CONSUMER_KEY, Constants.CONSUMER_SECRET);
   twitter.setOAuthAccessToken(a);
   //Some information is available through method calls
   int myid=twitter.getId();
   String username=twitter.getScreenName();

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

TwitterCredentials creds = null;
     try {
       httpOauthprovider.retrieveAccessToken(mOAuthConsumer, verifier);
       final String token = mOAuthConsumer.getToken();
       final String secret = mOAuthConsumer.getTokenSecret();
       final AccessToken accessToken = new AccessToken(token, secret);
       final Twitter twitter = TwitterFactory.getSingleton();
       twitter.setOAuthConsumer(mOAuthConsumer.getConsumerKey(), mOAuthConsumer.getConsumerSecret());
       twitter.setOAuthAccessToken(accessToken);
       final long twitterId = twitter.getId();
       final String twitterScreenName = twitter.getScreenName();
       creds = new TwitterCredentials();
       creds.oauthToken = token;
       creds.oauthSecret = secret;
       creds.twitterId = twitterId;
       creds.screenName = twitterScreenName;
     } catch (Exception e) {
       Log.e(TAG, "doTwitterConnect", e);
     }
     return creds;

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

System.out.println("Twitter Connected To : ");
User user = twitter.showUser(twitter.getId());
System.out.print(user.getScreenName());
if (user.getStatus() != null) {

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

/**
 * Answers user information for the authenticated user
 * <p/>
 * {@sample.xml ../../../doc/twitter-connector.xml.sample twitter:showUser}
 *
 * @return a {@link User} object
 * @throws TwitterException when Twitter service or network is unavailable
 */
@Processor
public User showUser() throws TwitterException {
  return getConnectionManagement().getTwitterClient().showUser(getConnectionManagement().getTwitterClient().getId());
}

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

/**
 * Returns a cursored collection of user objects for users following the specified user.<br>
 * At this time, results are ordered with the most recent following first, however, this ordering is subject to unannounced
 * change and eventual consistency issues. Results are given in groups of 20 users and multiple "pages" of results can be
 * navigated through using the next_cursor value in subsequent requests.
 * <p/>
 * {@sample.xml ../../../doc/twitter-connector.xml.sample twitter:getFollowers}
 *
 * @param cursor Causes the results to be broken into pages of no more than 20 records at a time.
 * @return Paginated list of followers
 * @throws TwitterException when Twitter service or network is unavailable
 * @see <a href="https://dev.twitter.com/docs/misc/cursoring">Using cursors to navigate collections</a>
 */
@Processor
public PagableResponseList<User> getFollowers(@Default(value = "-1") long cursor)
    throws TwitterException {
  return getConnectionManagement().getTwitterClient().getFollowersList(getConnectionManagement().getTwitterClient().getId(), cursor);
}

相关文章