Package weibo4j.org.json

Examples of weibo4j.org.json.JSONObject


    private List<Tweet> tweets;
    private static final long serialVersionUID = -9059136565234613286L;

    /*package*/ QueryResult(Response res, WeiboSupport weiboSupport) throws WeiboException {
        super(res);
        JSONObject json = res.asJSONObject();
        try {
            sinceId = json.getLong("since_id");
            maxId = json.getLong("max_id");
            refreshUrl = getString("refresh_url", json, true);

            resultsPerPage = json.getInt("results_per_page");
            warning = getString("warning", json, false);
            completedIn = json.getDouble("completed_in");
            page = json.getInt("page");
            query = getString("query", json, true);
            JSONArray array = json.getJSONArray("results");
            tweets = new ArrayList<Tweet>(array.length());
            for (int i = 0; i < array.length(); i++) {
                JSONObject tweet = array.getJSONObject(i);
                tweets.add(new Tweet(tweet, weiboSupport));
            }
        } catch (JSONException jsone) {
            throw new WeiboException(jsone.getMessage() + ":" + json.toString(), jsone);
        }
View Full Code Here


    }
   
    /*modify by sycheng add json define */
    /*package*/Comment(Response res) throws WeiboException {
        super(res);
        JSONObject json =res.asJSONObject();
        try {
      id = json.getLong("id");
      text = json.getString("text");
      source = json.getString("source");
      createdAt = parseDate(json.getString("created_at"), "EEE MMM dd HH:mm:ss z yyyy");
     
      if(!json.isNull("user"))
        user = new User(json.getJSONObject("user"));
    } catch (JSONException je) {
      throw new WeiboException(je.getMessage() + ":" + json.toString(), je);
    }
    }
View Full Code Here

    }

    public Comment(String str) throws WeiboException, JSONException {
        // StatusStream uses this constructor
        super();
        JSONObject json = new JSONObject(str);
        id = json.getLong("id");
        text = json.getString("text");
        source = json.getString("source");
        createdAt = parseDate(json.getString("created_at"), "EEE MMM dd HH:mm:ss z yyyy");

        user = new User(json.getJSONObject("user"));
    }
View Full Code Here

        init(res, elem, weibo);
    }
   
    Status(Response res)throws WeiboException{
      super(res);
      JSONObject json=res.asJSONObject();
      try {
      id = json.getLong("id");
      text = json.getString("text");
      source = json.getString("source");
      createdAt = parseDate(json.getString("created_at"), "EEE MMM dd HH:mm:ss z yyyy");

      inReplyToStatusId = getLong("in_reply_to_status_id", json);
      inReplyToUserId = getInt("in_reply_to_user_id", json);
      isFavorited = getBoolean("favorited", json);
      thumbnail_pic = json.getString("thumbnail_pic");
      bmiddle_pic = json.getString("bmiddle_pic");
      original_pic = json.getString("original_pic");
      if(!json.isNull("user"))
        user = new User(json.getJSONObject("user"));
      inReplyToScreenName=json.getString("inReplyToScreenName");
      if(!json.isNull("retweetDetails")){
        retweetDetails = new RetweetDetails(json.getJSONObject("retweetDetails"));
      }
    } catch (JSONException je) {
      throw new WeiboException(je.getMessage() + ":" + json.toString(), je);
    }
       
    }
View Full Code Here

    }
    }
    public Status(String str) throws WeiboException, JSONException {
        // StatusStream uses this constructor
        super();
        JSONObject json = new JSONObject(str);
        id = json.getLong("id");
        text = json.getString("text");
        source = json.getString("source");
        createdAt = parseDate(json.getString("created_at"), "EEE MMM dd HH:mm:ss z yyyy");

        inReplyToStatusId = getLong("in_reply_to_status_id", json);
        inReplyToUserId = getInt("in_reply_to_user_id", json);
        isFavorited = getBoolean("favorited", json);
        thumbnail_pic = json.getString("thumbnail_pic");
    bmiddle_pic = json.getString("bmiddle_pic");
    original_pic = json.getString("original_pic");
        user = new User(json.getJSONObject("user"));
        if(!json.isNull("retweetDetails")){
      retweetDetails = new RetweetDetails(json.getJSONObject("retweetDetails"));
    }
    }
View Full Code Here

    }
   
    /*modify by sycheng add json call*/
    /* package */ RateLimitStatus(Response res,Weibo w) throws WeiboException {
        super(res);
        JSONObject json=  res.asJSONObject();
        try {
      remainingHits = json.getInt("remaining_hits");
      hourlyLimit = json.getInt("hourly_limit");
      resetTimeInSeconds = json.getInt("reset_time_in_seconds");
      resetTime = parseDate(json.getString("reset_time"), "EEE MMM dd HH:mm:ss z yyyy");
    } catch (JSONException jsone) {
      throw new WeiboException(jsone.getMessage() + ":" + json.toString(), jsone);
    }
    }
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 {
      //自己与该关注对象的关系
      JSONObject object = getWeibo(true,args).showFriendships(args[2]);//args[2]:关注用户的id
      JSONObject source = object.getJSONObject("source");
      JSONObject target = object.getJSONObject("target");
      System.out.println(source.getString("screen_name")+"与"+target.getString("screen_name")+"互为关注");
      //两个用户关系的详细情况
      object =  getWeibo(true,args).showFriendships(args[3],args[4]);
      source = object.getJSONObject("source");
      target = object.getJSONObject("target");
      System.out.println(source.getString("screen_name")+"与"+target.getString("screen_name")+"互为关注");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

        nextCursor = getChildLong("next_cursor", elem);
    }

    /*package*/ IDs(Response res,Weibo w) throws WeiboException {
        super(res);
        JSONObject json=  res.asJSONObject();
        try {
          previousCursor = json.getLong("previous_cursor");
            nextCursor = json.getLong("next_cursor");
         
            if(!json.isNull("ids")){
            JSONArray jsona= json.getJSONArray("ids");
            int size=jsona.length();
            ids =new int[ size];
            for (int i = 0; i < size; i++) {
              ids[i] =jsona.getInt(i);
        }
View Full Code Here

        try {
          Weibo weibo = getWeibo(true,args);
          //IP必须被平台列入白名单方可执行注册接口
          String IP = InetAddress.getLocalHost().getHostAddress();
          //args参数从第三个开始为昵称、性别、密码、邮箱;
          JSONObject object = weibo.register(IP,args);
          System.out.println("Your ID:"+object.getString("uid"));
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

  public static void main(String[] args) {
    String access_token =args[0];
    Account am = new Account();
    am.client.setToken(access_token);
    try {
            JSONObject json = am.getAccountPrivacy();
      Log.logInfo(json.toString());
    } catch (WeiboException e) {
      e.printStackTrace();
    }
  }
View Full Code Here

TOP

Related Classes of weibo4j.org.json.JSONObject

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.