Instagram how to get my user id from username?

前端 未结 24 1001
傲寒
傲寒 2020-11-30 17:14

I\'m in the process of embedding my image feed in my website using JSON, the URL needs my user id so I can retrieve this feed.

So, where can I find/get my user id?

相关标签:
24条回答
  • 2020-11-30 17:54
    https://api.instagram.com/v1/users/search?q="[USERNAME]"&access_token=[ACCESS TOKEN]
    

    Please notice the quotation marks.

    This does not always return a valid result but more often than non-quoted one:

    https://api.instagram.com/v1/users/search?q="self"&count=1&access_token=[ACCESS TOKEN] 
    

    returns user "self" (id: 311176867)

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

    returns user "super_selfie" (id: 1422944651)

    0 讨论(0)
  • 2020-11-30 17:55

    I tried all the aforementioned solutions and none works. I guess Instagram has accelerated their changes. I tried, however, the browser console method and played around a bit and found this command that gave me the user ID.

    window._sharedData.entry_data.ProfilePage[0].graphql.user.id
    

    You just visit a profile's page and enter this command in the console. You might need to refresh the page for this to work though. (I had to post this as an answer, because of my low reputation)

    0 讨论(0)
  • 2020-11-30 17:55

    First Create an Application on Instagram and get Client Id for your application

    http://instagram.com/developer/

    Now just copy paste following Url into browser window by replacing your Username and your Client Id https://api.instagram.com/v1/users/search?q=[Your-username]&client_id=[Your-Client-Id]

    you will get a Json Result containing General Information about your account along with your Numeric user Id

    0 讨论(0)
  • 2020-11-30 17:57

    If you are using implicit Authentication must have the problem of not being able to find the user_id

    I found a way for example:

    Access Token = 1506417331.18b98f6.8a00c0d293624ded801d5c723a25d3ec the User id is 1506417331

    would you do a split single seperated by . obtenies to acces token and the first element

    0 讨论(0)
  • 2020-11-30 17:59

    Here is a really easy website that works well for me:

    http://www.instaid.co.uk/

    Or you can do the following replacing 'username' with your Instagram username

    https://www.instagram.com/username/?__a=1

    Or you can login to your Instagram account and use google dev tools and look at the cookies that have been stored. 'ds_user_id' is your user ID

    0 讨论(0)
  • 2020-11-30 18:00

    You need to use Instagrams API to convert your username to id.

    If I remember correctly you use users/search to find the username and get the id from there

    0 讨论(0)
提交回复
热议问题