1

I have designed a website which asks the user to enter his Instagram username, then it must extract the Instagram user ID from it and do the rest of work. my question is how to get the user ID from the username without the need to login in Instagram?

the (id to username) conversion has already been answered here, but I'm looking for (username to id) conversion. any help will be greatly appreciated.

Soheil
  • 587
  • 4
  • 20
  • 1
    Maybe ? https://stackoverflow.com/questions/37593025/instagram-api-get-the-userid – InUser Nov 03 '20 at 10:01
  • the solution mentioned there used to work, but now Instagram does not provide those information unless you log in-which is what I want to get rid of – Soheil Nov 03 '20 at 10:04
  • seems that I can use https://www.instagram.com/web/search/topsearch/?query=username without being logged in, and the response contains the pk – InUser Nov 03 '20 at 10:14
  • maybe you are already logged_in in the browser and so your cookies are being included in the request. have you checked? – Soheil Nov 03 '20 at 10:17
  • Yes, I have two different responses if I'm logged in/incognito but both of them has the PK – InUser Nov 03 '20 at 10:20
  • @Inga then that's awkward! because when I open https://www.instagram.com/web/search/topsearch/?query=username without cookies it gets redirected to https://www.instagram.com/accounts/login/?next=/web/search/topsearch/%3Fquery%3Dusername, which asks me to log in first! – Soheil Nov 03 '20 at 10:24
  • I tried from completely unrelated to Instagram PC, logging in is not required for this request – InUser Nov 03 '20 at 10:58
  • https://github.com/instaloader/instaloader/issues/388 – InUser Nov 03 '20 at 10:59
  • @Inga maybe it works without logging in, in some countries (for some IPs). but I can confirm that after trying many times without including cookies, it does not work! – Soheil Nov 04 '20 at 13:50

0 Answers0