2015-06-29 190 views
1

的基本信息,我有Instagram信息页/像不同用户的网址数量https://instagram.com/xxxxx/等等等等等等。我想获得该页面获取Instagram的网页

name, number of followers, description, bio,

我寻觅的以下信息,无不流露出使用访问令牌。但是,如果我从我的账户获取访问令牌,我很困惑,我怎样才能获得其他页面的信息?

请指导我该怎么做?

回答

2

你需要access token工作与Instagram的API。所以如果你得到一个access token你可以使用Instagram API。

要获得有关用户的基本信息,使用此:

https://api.instagram.com/v1/users/{user-id}/?access_token=ACCESS-TOKEN

{user-id}用户名。为了从用户名获得{user-id},使用此:

https://api.instagram.com/v1/users/search?q=[USERNAME]&access_token=[ACCESS TOKEN]

要获得access token使用这样的:

https://instagram.com/oauth/authorize/?client_id=[CLIENT_ID_HERE]&redirect_uri=http://localhost&response_type=token 

最后的反应会是这样的:

{ 
    meta: { 
     code: 200 
    }, 
    data: { 
     username: "lanadelrey", 
     bio: "Put not your trust in princes, nor in the son of man, in whom there is no help", 
     website: "http://www.lanadelrey.com", 
     profile_picture: "https://igcdn-photos-c-a.akamaihd.net/hphotos-ak-xpf1/t51.2885-19/10948781_564619503641170_898618667_a.jpg", 
     full_name: "Lana Del Rey", 
     counts: { 
      media: 114, 
      followed_by: 4207076, 
      follows: 78 
     }, 
     id: "305506437" 
    } 
} 
+0

并通过这样做我可以获得任何用户的信息? –

+0

@AwaisQarni是的,你可以。你只需要他们的'{user-id}'。我解释了如何得到它。 – Sky

+0

这正是我所需要的 –