Reputation: 758
I am trying to download the Instagram profile pic in 1080X1080 px. InstaFinsta doing the same thing but I can't figure out how they are generating this Instagram CDN link.
I have tried the below ways and I can get only 320X320 px of user profile picture.
https://www.instagram.com/rajjagani021/?__a=1
It will give you the graphQL
object and from that, I can extract the user profile picture. The CDN url will be like this
https://instagram.famd5-1.fna.fbcdn.net/v/t51.2885-19/s320x320/41357423_348923679180289_7232720902079643648_n.jpg?cb=9ad74b5e-c1c39920&_nc_ht=instagram.famd5-1.fna.fbcdn.net&_nc_cat=101&_nc_ohc=hD9ntdK-uOYAX8RzmzF&edm=ABfd0MgBAAAA&ccb=7-4&oh=00_AT8aBqCL_fzRNuynA9uBbOVs3pMIf93AEt6u2--waHGkHQ&oe=61F9877C&_nc_sid=7bff83
But when you use instafinsta.com it will give you the CDN url like this
https://scontent-lax3-2.cdninstagram.com/v/t51.2885-19/41357423_348923679180289_7232720902079643648_n.jpg?_nc_ht=scontent-lax3-2.cdninstagram.com&_nc_cat=101&_nc_ohc=hD9ntdK-uOYAX9FdM7s&edm=AEF8tYYBAAAA&ccb=7-4&oh=00_AT-DID52tJdZboddfvlJeDC72Ptp-5_bE_tY0jTQ6TBdew&oe=61FB5D72&_nc_sid=a9513d
So I can't figure out how to get this scontent-lax3-2...
CDN URL.
I have also tried the Instagram Basic Display API
but it also not working to get the 1080 profile pic.
I have checked the other StackOverflow answers but they are not giving any specific answer on scrapping the Instagram CDN URL like this and that's why I am posting the new question.
Any help would be appreciated.
Upvotes: 1
Views: 9799
Reputation: 1
First, you find the user_id in 'data'->'user'->'id' from:
https://www.instagram.com/api/v1/users/web_profile_info/?username={USERNAME}
Then you get the real HD image in 'user'->'hd_profile_pic_url_info'->'url' from:
https://i.instagram.com/api/v1/users/{user_id}/info/
Working by jan/23. Instagram changes things a lot.
EDIT: The second API call should not be done in batch, there is a high risk of getting blocked.
Upvotes: 0