如何通过 Instagram Api 获取用户的媒体?

How to get user's media through Instagram Api?

我可以使用

查看我的媒体
https://api.instagram.com/v1/users/self/media/recent/?access_token=**MY_ACCESS-TOKEN**

我想获取用户的媒体,所以我使用这个

https://api.instagram.com/v1/users/**ID_USER**/media/recent/?access_token=**MY_ACCESS_TOKEN**

我得到一个错误,因为他的帐户是私人的

{"meta":{"error_type":"APINotAllowedError","code":400,"error_message":"you cannot view this resource"}}

但我关注他,所以我应该看看他的媒体。我该怎么办?

在获取访问令牌之前,您是否像下面的 api 调用一样在获取访问代码中包含了范围?

https://api.instagram.com/oauth/authorize/?client_id=[]&redirect_uri=[]&response_type=code&scope=public_content

您必须将权限范围设置为 public 内容才能访问其他用户的媒体。

以下 link 对我有效,无需任何身份验证

https://www.instagram.com/{username}/media/