我需要如何以及通过该帖子的ID从帖子中获取用户名的请求? Instagram API

问题描述

我有两个access_tokens:

  1. 从Instagram Graph API:var fs_access_token(使用Facebook登录后获得);
  2. 来自Instagram基本显示var inst_access_token; 所以 我有收集的帖子ID,这些ID是通过ig_hashtag_search获得的:
var posts_ids; //!= null;

我在Instagram商业帐户上也有3条帖子。 然后,我尝试获取我的收藏夹中所有带有一个端点的所有帖子的用户名

for (var u = 0; u < posts_ids.length; u++) {
  fetch("https://graph.instagram.com/" + posts_ids[u] + "?fields=username&access_token=" + inst_access_token).then(function (response) {
  response.text().then(function (text) {
      alert(text); //using Instagram Basic display
    });
  });
}

但是随后我从此请求中得到了错误

{
   "error": {
      "message": "Unsupported get request. Object with ID '17884048231750634' does not exist,cannot be loaded due to missing permissions,or does not support this operation","type": "IGApiException","code": 100,"error_subcode": 33,"fbtrace_id": "AKiycowo9LbwZbKzxOL-EQ9"
   }
}

有趣的事实:如果我插入自己在Instagram商业帐户中拥有的帖子的ID而不是posts_ids [u],那么它将起作用! 所以,这到底是怎么回事?这意味着我只能从我在Instagram帐户上发布的帖子中获取用户名数据”,不是吗?还是什么? 我还尝试使用其他endpoind来获取用户名,当然我使用了其他access_token,这是我登录Facebook后获得的(上面我使用的access_token是access_token,这是我登录Instagram后获得的; Instagram Graph API-登录Facebook和Instagram基本显示-登录Instagram):

for (var u = 0; u < posts_ids.length; u++) {
   fetch("https://graph.facebook.com/v8.0/" + posts_ids[u] + "?fields=username&access_token=" + fs_access_token).then(function (response) {
      response.text().then(function (text) {
         alert(text);
      });
   });
}

但是我再次从请求中得到了错误

{
   "error": {
      "message": "Unsupported get request. Object with ID '17884048231750634' does not exist,or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api","type": "GraphMethodException","fbtrace_id": "AhN5o9eopccP4NrQsu8QuaN"
   }
}

这又是一个有趣的事实:如果我插入我在Instagram商业帐户中拥有的帖子的ID,而不是posts_ids [u],那么它将起作用! 我也尝试这样做:

for (var u = 0; u < posts_ids.length; u++) {
    fetch("https://graph.facebook.com/v8.0/" + posts_ids[u] + "?fields=username&access_token=" + inst_access_token).then(function (response) {
        response.text().then(function (text) {
           alert(text);
        });
    });
}

for (var u = 0; u < posts_ids.length; u++) {
    fetch("https://graph.instagram.com/" + posts_ids[u] + "?fields=username&access_token=" + fs_access_token).then(function (response) {
         response.text().then(function (text) {
             alert(text);
         });
    });
}

但随后出现此错误

{
   "error": {
      "message": "Invalid OAuth access token.","type": "OAuthException","code": 190,"fbtrace_id": "ARVMttFmcIAfwBTPdYcmefQ"
   }
}

这很可能是因为我试图将来自Instagram的访问令牌与用于Facebook的技术相结合,并将来自Facebook的访问令牌与用于Instagram的技术相结合。 那么,您能否不能帮助我在Instagram Basic或Instagram Graph中找到终结点,该终结点允许从其他用户的帖子中获取用户名(特别是通过Hashtag Search / recent_media获得的ID)?还是您不能帮助我理解如何正确使用它?因为我是一个初学者,可能不知道一些细节。请帮我通过帖子ID获取帖子的用户名

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)