Package weibo4j.org.json

Examples of weibo4j.org.json.JSONObject


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


    Weibo weibo = new Weibo();
    String access_token = args[0];
    weibo.setToken(access_token);
    Account am = new Account();
    try {
      JSONObject uid = am.getUid();
      Log.logInfo(uid.toString());
    } catch (WeiboException e) {
      e.printStackTrace();
    }
  }
View Full Code Here

    String access_token ="2.00RQs9XCjP8_PC27953e0bc62cwKCE";
    Weibo weibo = new Weibo();
    weibo.setToken(access_token);
    Favorite fm = new Favorite();
    try {
      JSONObject ids = fm.getFavoritesIds();
      Log.logInfo(ids.toString());
    } catch (WeiboException e) {
      e.printStackTrace();
    }

  }
View Full Code Here

    weibo.setToken(access_token);
    Favorite fm = new Favorite();
    String tid = args[1];
    String tag= args[2];
    try {
      JSONObject json = fm.updateFavoritesTagsBatch(tid, tag);
      Log.logInfo(json.toString());
    } catch (WeiboException e) {
      e.printStackTrace();
    }
  }
View Full Code Here

  /*
   * 澶勭悊瑙f瀽鍚庣殑json瑙f瀽
   */
  public String ts(String json) {
    try {
      JSONObject jsonObject = new JSONObject(json);
      access_token = jsonObject.getString("oauth_token");
      user_id = jsonObject.getString("user_id");
    } catch (JSONException e) {
      e.printStackTrace();
    }
    return access_token;

View Full Code Here

            profileBackgroundTile = json.getString("profile_background_tile");
            following = getBoolean("following", json);
            notificationEnabled = getBoolean("notifications", json);
            statusesCount = json.getInt("statuses_count");
            if (!json.isNull("status")) {
                JSONObject status = json.getJSONObject("status");
                statusCreatedAt = parseDate(status.getString("created_at"), "EEE MMM dd HH:mm:ss z yyyy");
                statusId = status.getLong("id");
                statusText = status.getString("text");
                statusSource = status.getString("source");
                statusTruncated = status.getBoolean("truncated");
                statusInReplyToStatusId = status.getLong("in_reply_to_status_id");
                statusInReplyToUserId = status.getInt("in_reply_to_user_id");
                statusFavorited = status.getBoolean("favorited");
                statusInReplyToScreenName = status.getString("in_reply_to_screen_name");
            }
        } catch (JSONException jsone) {
            throw new WeiboException(jsone.getMessage() + ":" + json.toString(), jsone);
        }
    }
View Full Code Here

     * @return response body as sinat4j.org.json.JSONObject
     * @throws WeiboException
     */
    public JSONObject asJSONObject() throws WeiboException {
        try {
            return new JSONObject(asString());
        } catch (JSONException jsone) {
            throw new WeiboException(jsone.getMessage() + ":" + this.responseAsString, jsone);
        }
    }
View Full Code Here

    }

    /*package*/
    static List<Trends> constructTrendsList(Response res) throws
            WeiboException {
        JSONObject json = res.asJSONObject();
        List<Trends> trends;
        try {
            Date asOf = parseDate(json.getString("as_of"));
            JSONObject trendsJson = json.getJSONObject("trends");
            trends = new ArrayList<Trends>(trendsJson.length());
            Iterator ite = trendsJson.keys();
            while (ite.hasNext()) {
                String key = (String) ite.next();
                JSONArray array = trendsJson.getJSONArray(key);
                Trend[] trendsArray = jsonArrayToTrendArray(array);
                if (key.length() == 19) {
                    // current trends
                    trends.add(new Trends(res, asOf, parseDate(key
                            , "yyyy-MM-dd HH:mm:ss"), trendsArray));
View Full Code Here

        }
    }

    /*package*/
    static Trends constructTrends(Response res) throws WeiboException {
        JSONObject json = res.asJSONObject();
        try {
            Date asOf = parseDate(json.getString("as_of"));
            JSONArray array = json.getJSONArray("trends");
            Trend[] trendsArray = jsonArrayToTrendArray(array);
            return new Trends(res, asOf, asOf, trendsArray);
        } catch (JSONException jsone) {
            throw new WeiboException(jsone.getMessage() + ":" + res.asString(), jsone);
        }
View Full Code Here

    }

    private static Trend[] jsonArrayToTrendArray(JSONArray array) throws JSONException {
        Trend[] trends = new Trend[array.length()];
        for (int i = 0; i < array.length(); i++) {
            JSONObject trend = array.getJSONObject(i);
            trends[i] = new Trend(trend);
        }
        return trends;
    }
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.