Instagram ID to username

爷,独闯天下 提交于 2019-12-11 00:50:07

问题


Is it possible to get the instagram username when you have the instagram ID? If yes please show an example.

I have seen in the internet people talking about an API and they use a link which looks like the following:

https://api.instagram.com/v1/users/self/?access_token=ACCESS-TOKEN

回答1:


yes, try this

async function insta(uid) {
  let api = `https://i.instagram.com/api/v1/users/${uid}/info/`
  let info = await (await fetch(api)).json();
  return "https://www.instagram.com/" + info.user.username;
}

async function go() {
  let url = await insta(txt.value)
  link.innerText = link.href = url;
}
Type instagram user id:
<input id="txt" value=1791879548 />
<button onclick="go()">GO!</button><br>
<pre id="link"></pre>



回答2:


Consider making call to https://api.instagram.com/v1/users/[USER-ID]?access_token=[YOUR-ACCESS-TOKEN] with a public_content scope applied to it in order to search for username from user id as explained in the Instagram documentation. As of the latest API version right now, you'll need to make submission for extended permission to access the scope.




回答3:


Yes it is possible.

http://instagram.com/web/friendships/{user-id-here}/follow/

You can try live in here

http://socialint.net/en/instagram/




回答4:


1) Copy the below code snippet
2) Save it as Instagram.htm
3) Open the page in the web browser

<html>
<script>async function getinstagramName(uid) {
  let api = `https://i.instagram.com/api/v1/users/${uid}/info/`
  let info = await (await fetch(api)).json();
  return info.user.username;
}

async function Search() {
  let url = await getinstagramName(instagramUserID.value)
  mkm.hidden=false
  mkm.text=url
  mkm.href="https://www.instagram.com/" + url  
  link.innerText ="https://www.instagram.com/" +url;
}</script>
<body>
instagram user id:
<input id="instagramUserID" value="" />
<button onclick="Search()">GO!</button><br>
<pre id="link"></pre>
<a hidden=true id="mkm" href=''>InstagramLink</a>
</body>
</html>


来源:https://stackoverflow.com/questions/41042025/instagram-id-to-username

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!