Download an Instagram Display Picture within Seconds Using Python
If you’re trying to download a display picture (DP) from Instagram, you could try using some websites to download it but there end up being a lot of bugs some sites ask you to wait for 3 to 10 minutes and some don’t work 😕. And so, here I am to help you out in this situation.
Hey, everyone. And welcome back to another blog of mine. Today, I’m going to tell you how to download an Instagram DP using Python. Please be sure to use what you learn here ethically. And so, without any further ado, let’s get started.
About the package
We know that Python is a cool programming language that has a lot of packages, and here we are going to use one of them: INSTALOADER.
The Instaloader module is a Python package having well-defined functionalities to scrap Instagram, its functions can be used as a command-line utility. The Installer can not only be used to download Instagram display pictures but also lets you download other information such as:
- Posts of an account
- Comments on post
- Profile information
- Story highlights
First of all, we need to download the package, and to do that, open your command prompt in Windows or your respective terminal based on the operating system you use and type in the code
pip install instaloader
Once the installation is complete then open your preferred code editor and import the package using the code
To download a display picture, firstly we have to create an instance for the package
dp = instaloader.Instaloader() #I'm using a variable dp
To download the DP, we will use the function “download_profile”
With the function “download_profile” we can download many things such as all the posts posted by the user, his profile bio, and many things.
In the above gif, u can see that I have downloaded the profile of the famous Instagram page Sarcastic Us. You can see that the file comprises a total of 891MB and it contains all the posts that sarcastic us has posted on his Insta page and it hardly took 3 minutes to download’em all.
Note: You can use the function only if the particular Instagram account is public.
Coming into our topic on downloading profile pictures, we have to use another parameter that is “profile_pic”
dp.download_profile("sarcastic_us", profile_pic = True)
Using the above code, you download the total profile and also the profile picture, but still, with this parameter, you can’t use this for the Instagram profiles that are private.
To download the profile picture of private accounts, we have to use another parameter
dp.download_profile("sarcastic_us", profile_pic_only = True)
The parameter “profile_pic_only” when it is set to True then it will only download the profile picture of the account either it is private or public, it doesn’t matter.
And finally, we got our desired output, which is the picture we need as a “.jpg” file.
And with this, we can download Instagram display pictures.
Everyone stay tuned. To get my stories in your mailbox, kindly subscribe to my newsletter. Thank you for reading! Do not forget to leave your claps and share your responses and share them with a friend.