1

I need to scrape Instagram by user id number instead of username. How can I do it?

You can access user profile like this

https://instagram.com/{username}

but I need to access it like below. It doesn't have to be exactly like below. Is it possible to find such path?

https://instagram.com/{profile_id}
sql-noob
  • 383
  • 6
  • 16

2 Answers2

0

I don't think there's any possible way to do it. Anyway, how do you get the profile_id. I thought it is not available to be seen anywhere?

Yongky Ali
  • 471
  • 4
  • 12
  • it is available. you can access it via javascript variable called window._sharedData – sql-noob Oct 13 '18 at 19:31
  • @if237912print I see there! But still, I don't think you would be able to do that via web-sracping. You may try using other private APIs written in PHP or Python (I answered it in this post https://stackoverflow.com/a/52602041/7498283). You will be able to get user's info my `profile_id`. – Yongky Ali Oct 14 '18 at 12:58
0

you could send a GET request to this url

https://i.instagram.com/api/v1/users/<user_id>/info/

from its response you'll get the username and from that you can use your initial url

https://instagram.com/<username>/
Liam
  • 6,009
  • 4
  • 39
  • 53