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

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

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

Twitter.getFavorites介绍

[英]Returns the 20 most recent favorite statuses for the authenticating user or user specified by the ID parameter in the requested format.
[中]以请求的格式返回身份验证用户或由ID参数指定的用户的20个最新常用状态。

代码示例

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

/**
 * Returns the 20 most recent favorite statuses for the authenticating user or user specified by the ID parameter in the requested format.
 *
 * @return List<Status>
 * @throws TwitterException when Twitter service or network is unavailable
 * @see <a href="http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-favorites">Twitter API Wiki / Twitter REST API Method: favorites</a>
 * @deprecated Use getFavorited() instead
 */
public List<Status> favorites() throws TwitterException {
  return getFavorites();
}

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

/**
 * Returns the 20 most recent favorite statuses for the authenticating user or user specified by the ID parameter in the requested format.
 *
 * @param id   the ID or screen name of the user for whom to request a list of favorite statuses
 * @param page the number of page
 * @return List<Status>
 * @throws TwitterException when Twitter service or network is unavailable
 * @deprecated Use getFavorites(String id, int page) instead
 * @see <a href="http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-favorites">Twitter API Wiki / Twitter REST API Method: favorites</a>
 */
public List<Status> favorites(String id, int page) throws TwitterException {
  return getFavorites(id, page);
}

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

/**
 * Returns the 20 most recent favorite statuses for the authenticating user or user specified by the ID parameter in the requested format.
 *
 * @param page the number of page
 * @return List<Status>
 * @throws TwitterException when Twitter service or network is unavailable
 * @see <a href="http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-favorites">Twitter API Wiki / Twitter REST API Method: favorites</a>
 * @deprecated Use getFavorites(int page) instead
 */
public List<Status> favorites(int page) throws TwitterException {
  return getFavorites(page);
}

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

/**
 * Returns the 20 most recent favorite statuses for the authenticating user or user specified by the ID parameter in the requested format.
 *
 * @param id the ID or screen name of the user for whom to request a list of favorite statuses
 * @return List<Status>
 * @throws TwitterException when Twitter service or network is unavailable
 * @see <a href="http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-favorites">Twitter API Wiki / Twitter REST API Method: favorites</a>
 * @deprecated Use getFavorites(String id) instead
 */
public List<Status> favorites(String id) throws TwitterException {
  return getFavorites(id);
}

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

@Override
  public void invoke(List<TwitterListener> listeners) throws TwitterException {
    ResponseList<Status> statuses = twitter.getFavorites(screenName, paging);
    for (TwitterListener listener : listeners) {
      try {
        listener.gotFavorites(statuses);
      } catch (Exception e) {
        logger.warn("Exception at getFavorites", e);
      }
    }
  }
});

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

@Override
  public void invoke(List<TwitterListener> listeners) throws TwitterException {
    ResponseList<Status> statuses = twitter.getFavorites(userId);
    for (TwitterListener listener : listeners) {
      try {
        listener.gotFavorites(statuses);
      } catch (Exception e) {
        logger.warn("Exception at getFavorites", e);
      }
    }
  }
});

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

@Override
  public void invoke(List<TwitterListener> listeners) throws TwitterException {
    ResponseList<Status> statuses = twitter.getFavorites(userId, paging);
    for (TwitterListener listener : listeners) {
      try {
        listener.gotFavorites(statuses);
      } catch (Exception e) {
        logger.warn("Exception at getFavorites", e);
      }
    }
  }
});

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

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

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

@Override
  public void invoke(List<TwitterListener> listeners) throws TwitterException {
    ResponseList<Status> statuses = twitter.getFavorites(screenName);
    for (TwitterListener listener : listeners) {
      try {
        listener.gotFavorites(statuses);
      } catch (Exception e) {
        logger.warn("Exception at getFavorites", e);
      }
    }
  }
});

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

@Override
  public void invoke(List<TwitterListener> listeners) throws TwitterException {
    ResponseList<Status> statuses = twitter.getFavorites(paging);
    for (TwitterListener listener : listeners) {
      try {
        listener.gotFavorites(statuses);
      } catch (Exception e) {
        logger.warn("Exception at getFavorites", e);
      }
    }
  }
});

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

public final class GetFavorites {
  /**
   * Usage: java twitter4j.examples.favorite.GetFavorites
   *
   * @param args message
   */
  public static void main(String[] args) {
    try {
      Twitter twitter = new TwitterFactory().getInstance();
      List<Status> statuses = twitter.getFavorites();
      for (Status status : statuses) {
        System.out.println("@" + status.getUser().getScreenName() + " - " + status.getText());
      }
      System.out.println("done.");
      System.exit(0);
    } catch (TwitterException te) {
      te.printStackTrace();
      System.out.println("Failed to get favorites: " + te.getMessage());
      System.exit(-1);
    }
  }
}

相关文章