gpt4 book ai didi

java - 通过 instagram api 获取评论

转载 作者:搜寻专家 更新时间:2023-11-01 03:34:34 26 4
gpt4 key购买 nike

当我尝试获取对媒体的评论时,它只返回访问 token 所有者用户的评论,而没有其他用户的评论。

查询:

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

关于java - 通过 instagram api 获取评论,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35111982/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com