Instagram API - 用户照片

8

有没有人知道如何在不使用访问令牌的情况下获取Instagram用户的照片。看到{user}的照片在http://instagram.com/上,但无法使用Instagram API获取它们,这并没有意义。

谢谢

5个回答

2

要获取照片,您不需要使用访问令牌。只需调用:

https://api.instagram.com/v1/users/{user-id}/media/recent?callback=&client_id={client_id}

你可以在这里创建你的client_id:

https://instagram.com/developer/clients/manage/


1

谢谢Ryan。我不确定,但我认为followgram.me使用访问令牌来获取用户Instagram照片。在它过期后,我想followgram将无法获取我的最新照片。 - Ibrahim19
“浏览用户的动态”并不等同于用户自己发布的照片。对于大多数情况,您只需要client_id即可。 - dayuloli
这不是正确的答案,正如已经说明的那样。Javier和dayuloli在下面给出了正确的答案。 - AndyRyan

1

您根本不需要使用access_token。只需在Instagram上注册您的应用程序,获取client_id并使用它进行查询。

引用文档

请注意,在许多情况下,您可能根本不需要对用户进行身份验证。例如,您可以在不进行身份验证的情况下请求热门照片(即,您无需提供access_token; 只需使用您的客户端ID进行请求)。我们仅在您的应用程序代表用户进行请求时(评论、点赞、浏览用户的Feed等)要求身份验证。


很遗憾,这已经过时了。在2016年insta的变化之后。 - Joe Johnston

0

获取数据有两种方式

1)客户端 - 您需要提供客户端ID

2)服务器端 - 您需要提供访问令牌

https://api.instagram.com/v1/users/#{instagram_id}/media/recent/?access_token=#{@token}"

这将为您提供给定Instagram ID的用户最近上传的照片...


0

你好,这里有一个获取用户图像的示例,请按照以下代码操作:

/* Get image in your instagram Account */

$set_scope_your_app ="https://www.instagram.com/oauth/authorize/?

client_id=Added-your-client_id&

redirect_uri=Added-your-redirect_uri&response_typ

e=code&scope=public_content";


$get_acess_token = "https://instagram.com/oauth/authorize/?

client_id=Added-your-client_id&

redirect_uri=Added-your-redirect_uri&respons

e_type=token";

$url="https://api.instagram.com/v1/users/self/media/recent/?access_token=Added-your-access_token";
 $json = file_get_contents($url);
$data = json_decode($json);


$images = array();
foreach( $data->data as $user_data ) {
    $images[] = (array) $user_data->images;
}

$standard = array_map( function( $item ) {
    return $item['standard_resolution']->url;
}, $images );

echo "<pre>";
print_r($standard);


echo "<pre>";
print_r($standard);

我从在Instagram中获取用户媒体或图像的示例中获得了参考。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接