This method won’t work anymore since Instagram made changes to their API
This is for educational purposes only. I am not responsible for ANY damage you create by following this tutorial!
Some of you might know that I have a page where you can see Instagram Profile Pictures of any User in Full Size and High Resolution (nearly the Resolution it was uploaded!)
In this Post I want to show you, how I get these Images. It’s actually not that hard, but a little bit complicated.
For some time, you could simply add a ?__a=1 to the profile picture URL. So it would look like this: https://www.instagram.com/dunklesToast/?__a=1 . This returned a nice JSON where the URL for the High Resolution ProfilePic. Since the Facebook / Cambridge Analytica scandal Instagram does not allow this URL anymore and you’ll get a Error 403.
So, what now?
Instagram made it hard to get the profile pics – but not impossible.
There is another URL but you need the Instagram User ID from the User. I know 3 ways how to get it:
- Load the Instagram Userpage (e.g.
https://www.instagram.com/dunklesToast) and inspect the page. In the Chrome Console enter
Instagram Get ID by Browser ConsoleDefault1window._sharedData.entry_data.ProfilePage.graphql.user.id
- Over the Instagram API. You can get the ID over the official Instagram API. Just view the Documentation and then you are ready to go!
- codeofaninja.com – this is a page I am not related to in any way. I just found it while searching for a way to convert Username to ID. codeofaninja has a service where you can search Instagram users and they return you the IDs. If you inspect the page you see that it uses a PHP Script which returns HTML so you need to use a regex or smth. similar to parse it. This way works but you need to loop through all results, since the Instagram Search is not really great at special characters and Usernames starting with “_” aren’t always the first hit.
When you have the ID…
…you are ready to go. Check out that Endpoint: http://i.instagram.com/api/v1/users/<id>/info/. This is all you need! Replace the ID Placeholder with your ID and you should see a beautiful JSON with the links in there. ( user.hd_profile_pic_versions.url seems to be always the highest resolution)
So thats it! I hope this tutorial helped you a little bit 🙂