Package weibo4j

Examples of weibo4j.Paging


  public static void main(String[] args) {
    System.setProperty("weibo4j.oauth.consumerKey", Weibo.CONSUMER_KEY);
      System.setProperty("weibo4j.oauth.consumerSecret", Weibo.CONSUMER_SECRET);
    try {
      //获取24小时内前20条用户的微博信息;args[2]:用户ID
      List<Status> statuses = getWeibo(false,args).getUserTimeline(args[2],new Paging(1,200));
      for (Status status : statuses) {
              System.out.println(status.getUser().getName() + ":" +
                                 status.getText());
          }
    } catch (WeiboException e) {
View Full Code Here


  public static void main(String[] args) {
    System.setProperty("weibo4j.oauth.consumerKey", Weibo.CONSUMER_KEY);
      System.setProperty("weibo4j.oauth.consumerSecret", Weibo.CONSUMER_SECRET);
        try {
          Weibo weibo = getWeibo(true,args);
          List<Status> list = weibo.getUserTimeline("1748033497", new Paging(1).count(4));
          if(list.size() > 0) {
            Status status = weibo.showStatus(list.get(0).getId());
              System.out.println( status.getId() + "  : "+status.getText());
          }
    } catch (Exception e) {
View Full Code Here

   */
  public List<Status> getUserTimeline(Long sinceId, Long maxId) {

  try {
    // sinaへの問い合わせパラメータを初期化する
    Paging paging = new Paging();
    // 取得ページ数
    paging.setPage(Integer.valueOf(this.configMap.get("sina.usertimeline.paging.page")));
    // 取得数
    paging.setCount(Integer.valueOf(this.configMap.get("sina.usertimeline.paging.count")));

    // 取得範囲の開始位置の指定
    if (sinceId != null) {
    paging.setSinceId(Long.valueOf(sinceId));
    }

    // 取得範囲の終了位置の指定
    if (maxId != null) {
    paging.setMaxId(Long.valueOf(maxId));
    }

    log.info("sinaからメッセージIDが \"" + paging.getSinceId() + "\"以降のユーザメッセージを取得する");

    // 問い合わせを行う
    return this.weibo.getUserTimeline(paging);

  } catch (Exception e) {
View Full Code Here

  }

  public List<Comment> getCommentTimeline(Long sinceId, Long maxId) {
  try {
    // sinaへの問い合わせパラメータを初期化する
    Paging paging = new Paging();
    // 取得ページ数
    paging.setPage(Integer.valueOf(this.configMap.get("sina.usercomment.paging.page")));
    // 取得数
    paging.setCount(Integer.valueOf(this.configMap.get("sina.usercomment.paging.count")));

    // 取得範囲の開始位置の指定
    if (sinceId != null) {
    paging.setSinceId(Long.valueOf(sinceId));
    }

    // 取得範囲の終了位置の指定
    if (maxId != null) {
    paging.setMaxId(Long.valueOf(maxId));
    }

    log.info("sinaからコメントIDが \"" + paging.getSinceId() + "\"以降のユーザコメントを取得する");

    // 問い合わせを行う
    return this.weibo.getCommentsTimeline(paging);

  } catch (Exception e) {
View Full Code Here

TOP

Related Classes of weibo4j.Paging

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.