java – 获得instagram api的评论

当我试图向媒体发表评论时,它只返回访问令牌所有者用户评论,而没有其他用户评论.

查询:

https://api.instagram.com/v1/media/"+mediaId+"/comments?access_token="+token

所以最终查询看起来像:

https://api.instagram.com/v1/media/1162251688307718037_1824437940/comments?access_token=token

回答:

`{"meta":{"code":200},"data":[{"created_time":"1453069290","text":"comment_text_here","from":{"username":"username","profile_picture":"profile_picture","id":"user_id","full_name":"full_name"},"id":"1164752089812694405"}]}'

获取媒体ID:

https://api.instagram.com/v1/users/self/media/recent/?access_token="+token+"&count=30

获取媒体ID列表

JSONObject json = new JSONObject(comments);
    JSONArray data = json.getJSONArray("data");
    if (data.length()>0) {
        for (int i = 0; i < data.length(); i++) {
            JSONObject obj = (JSONObject) data.get(i);
            list.add(obj.getString("id"));
            //System.out.println(obj.getString("id"));
        }
    }

我的错误或是沙盒应用的api instagram限制?

最佳答案 在沙盒模式下是,它将仅从沙箱授权用户返回媒体,如果您添加已注释到沙箱的用户,则该注释将显示在API响应中.

https://www.instagram.com/developer/sandbox/

To help you develop and test your app, the users and media available
in Sandbox mode are real Instagram data (i.e. what is normally visible
in the Instagram app), but with the following conditions:

  • Apps in sandbox are restricted to 10 users
  • Data is restricted to the 10 users and the 20 most recent media from each of those users
  • Reduced API rate limits
点赞