Download Instagram Profile

Download Instagram Profile

Hello Techies 👋 Welcome to my Blog.

In this Article, You will learn about how to download anyone's instagram profile picture😉.

I guess there is no one who is not aware of instagram. We all use it in our daily life. But, There is no option in instagram to save or view others profile pictures. This is the main reason that made me to do this project. Instagram doesn't give an option to view a profile photo? No worries, when we have Python🤩.

So, Let's get Started.

Prerequisites:

- python
- instaloader

Installation:

Run the below command to install instaloder. You can find more detailes about instaloader here

pip install instaloader

Time to Code😎

Step 1: Importing the modules

import instaloader

The above lines imports the instaloader module to use it in your program.

Step 2: Getting an instance

ig = instaloader.Instaloader()

To interact with instagram from python, we need to get an instance first. Instaloader() is the main class of instaloader module. We will use it to get the instance.

Step 3: Get the username

dp = input("enter username")

To download the profile picture, you need to know the username first. So, you can ask the user to input the username or you can also give a static username in the program itself.

Step 4: Downloading Profile

ig.download_profile(dp, profile_pic_only=True)
print("Downloaded")

The instance object that we created earlier ig has a download_profile method which takes the argument dp which is the username. There is another argument which is profile_pic_only. It should be set to the value True if you want to download the profile picture.

Now you are done with coding.

When you run this program, it will ask the user to input the username. Once the user gives the username and hits enter, a folder with the name as username will automatically gets created in the working directory and the profile picture will be saved here.

You can do much more with the instaloader. I will try to share it in the upcoming articles.

All done. Complete code is available here

Thank you for reading :)

Did you find this article valuable?

Support Lakshmi Sowjanya's Blog by becoming a sponsor. Any amount is appreciated!