Package weibo4j

Examples of weibo4j.Status


            /*
       * 此处需要填写AccessToken的key和Secret,可以从OAuthUpdate的执行结果中拷贝过来
             */
            weibo.setToken("e42f35bd66fce37d7c6dfeb6110d8957", "a1943b8ea10eb708e67825d25675d246");
           
            Status status = weibo.updateStatus("你好吗?");
           
            System.out.println("Successfully updated the status to [" + status.getText() + "].");
            System.exit(0);
        } catch (WeiboException te) {
            System.out.println("Failed to get timeline: " + te.getMessage());
            System.exit( -1);
        } catch (Exception ioe) {
View Full Code Here


    }
       
        String msg = args[2] + new java.util.Date();
       
        // normal status
         Status status = weibo.updateStatus(args[2] + System.currentTimeMillis());
        // status with geocode
    try {
      status = weibo.updateStatus(msg, 40.7579, -73.985);
    } catch (JSONException e1) {
      e1.printStackTrace();
    }
       
        long l2 = System.currentTimeMillis();
       
        System.out.println("Successfully updated the status to [" + status.getText() + "].");
        System.out.println("Time elapsed: " + (l2 - l1));
       
        try {
      Thread.sleep(1000); // avoid flush server
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
        // add a comment for the status
        long sid = status.getId();
        Comment cmt = weibo.updateComment("评论1 " + new java.util.Date(),  String.valueOf(sid), null);
       
        weibo.getComments(String.valueOf(sid));
       
        weibo.updateComment("评论2 " + new java.util.Date(),  String.valueOf(sid), null);
View Full Code Here

    try {
      Weibo weibo = new Weibo();

      weibo.setToken(access.getToken(), access.getTokenSecret());

      Status status = weibo.updateStatus(content);
      System.out.println("Successfully updated the status to ["
          + status.getText() + "].");
    } catch (WeiboException e) {
      e.printStackTrace();
    }
  }
View Full Code Here

          System.out.println("file is null");
          System.exit(-1);
        }
       
        String msg = URLEncoder.encode("中文内容", "UTF-8");
        Status status = weibo.uploadStatus(msg + "cvvbqwe1343", file);

        System.out.println("Successfully upload the status to ["
            + status.getText() + "].");
       
      } catch (Exception e1) {
        e1.printStackTrace();
      }
    } catch (Exception ioe) {
View Full Code Here

            /*
       * 此处需要填写AccessToken的key和Secret,可以从OAuthUpdate的执行结果中拷贝过来
             */
            weibo.setToken(args[0], args[1]);
     
            Status status = weibo.updateStatus(args[2]);
            System.out.println("Successfully updated the status to [" + status.getText() + "].");
            System.exit(0);
        } catch (WeiboException te) {
            System.out.println("Failed to get timeline: " + te.getMessage());
            System.exit( -1);
        } catch (Exception ioe) {
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 {
      Status status = getWeibo(true,args).createFavorite(Long.parseLong(args[2]));
      System.out.println(status.toString());
    } catch (WeiboException e) {
      e.printStackTrace();
    }
  }
View Full Code Here

            //最新一条微博信息id
            String sid = list.get(0).getId()+"";
            List<Comment> comments = weibo.getComments(sid);
            if(comments.size() > 0) {
              String cid = comments.get(0).getId()+"";//评论的id
              Status status = weibo.reply(sid, cid, "回复内容");//args[3]:回复内容
              System.out.println(status.toString());
            }
          }
    } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here

        try {
          Weibo weibo = getWeibo(true,args);
          String sid = "";
          Thread.sleep(1000);
          //args[2]:添加转发的信息
          Status status = weibo.repost(sid, args[2]);
          System.out.println(status.toString());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
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);
          Status status = weibo.updateStatus("新增微博信息");
          Thread.sleep(1000);
          String sid = status.getId()+"";
          System.out.println(sid + " : "+ status.getText()+"  "+status.getCreatedAt());
          Comment comment = weibo.updateComment("发表评论", sid, null);
          System.out.println(comment.getId() + " : " + comment.getText() + "  " + comment.getCreatedAt());
          Thread.sleep(1000);
          weibo.destroyComment(comment.getId());
    } catch (Exception e) {
View Full Code Here

    System.setProperty("weibo4j.oauth.consumerKey", Weibo.CONSUMER_KEY);
      System.setProperty("weibo4j.oauth.consumerSecret", Weibo.CONSUMER_SECRET);
        try {
          Weibo weibo = getWeibo(true,args);
          //先发表一篇微博
          Status status = weibo.updateStatus("测试测试");
          System.out.println(status.getId() + " : "+ status.getText()+"  "+status.getCreatedAt());
          //删除刚发表的微博
          status = weibo.destroyStatus(status.getId());
          List<Status> list = weibo.getUserTimeline(args[2]);//args[2]:用户id
          for(Status st : list) {//遍历当前微博信息
            System.out.println(st.getId() + " : "+ st.getText()+"  "+st.getCreatedAt());
          }
    } catch (Exception e) {
View Full Code Here

TOP

Related Classes of weibo4j.Status

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.