Download Display Picture of an Instagram Account Using Python

Subscribe to my newsletter and never miss my upcoming articles

Hello world!

I am attending a Technical Writing Bootcamp at @hashnode. Hashnode Bootcamp II is a free virtual Bootcamp to help beginner technical writers to improve their writing skill. This article is inspired by the latest session by Anna McDougall, [@AnnaJMcDougall]

TASK: In 7 days, write a blog post from one of the topics you learned during the session

In this Blog article, I will share my thoughts on the same. Let's get started.

Have you heard about Instagram? Do you Use Instagram? Well, In this Blog article, we will learn how to Download Display Picture of an Instagram Account. We will see the implementation in Python.

Check out the Repository for Ultimate Resource in python. Drop a star if you find it useful! Got anything to add? Open a PR on the same!

You can refer to my YouTube video Tutorial to see a working tutorial for better Understanding and a step by step Guide of the same.

What will be covered in this Blog

1. Instagram Introduction
2. Instaloader Introduction
3. How to Download Display Picture of an Instagram Account

Instagram Introduction:

I do not think Instagram needs an Introduction but for those who do not know, Instagram is an photo and video sharing social networking platform owned by Facebook. If you wish to know more about Instagram, you can refer its Wikipedia page.

Instagram Link: instagram.com

Instaloader Introduction:

The Instaloader module is python package having great functionalities to scrap instagram, it’s functions can be used as command line utility. It can be used for download pictures (or videos) along with their captions and other metadata from Instagram.

Key Features of Instaloader:

  • downloads public and private profiles, hashtags, user stories, feeds and saved media,
  • downloads comments, geotags and captions of each post,
  • automatically detects profile name changes and renames the target directory accordingly,
  • allows fine-grained customization of filters and where to store downloaded media,
  • automatically resumes previously-interrupted download iterations.

If you wish to know more about it, you can refer to Instaloader Documentation. Use this link to navigate to the documentation.

Now that you are aware of Instaloader basics, we can move forward to the coding section. Let's get started!

Time to Code!

You can find all the code at my GitHub Repository. Drop a star if you find it useful.

code.png

In order to access the Python library, you need to install it into your Python environment, use the following command to install Instaloader

pip install instaloader

Now, let's import the package in our Python script and create an instance test

import instaloader

test = instaloader.Instaloader()

Once done, let's take user input to get the username of the account you wish to download the profile picture ! I am storing it in acc

acc = input('Enter the Account Username: ')

#acc = 'leomessi'

So here, Assuming you all must have heard the name of Lionel Messi, we have entered the account username as leomessi.

Finally, its time to download the data.

We will make use of download_profile method here and pass in two parameters:

  • acc: the username
  • profile_pic_only: we will set this to be True.
test.download_profile(acc, profile_pic_only = True)

A new folder will be created with the account username, in our case, leomessi and it will contain the Display Picture.

2018-10-23_13-55-58_UTC_profile_pic.jpg

Let's have a look at the output. It will look something like this:

ezgif.com-gif-maker.gif

This is how you can Download Display Picture of an Instagram Account using python script. That's it!

Simple, isn't it? Hope this tutorial has helped. I would strongly recommend you to Check out the YouTube video of the same and don't forget to subscribe my Channel.

You can play around with the Instaloader library and even explore more features. You can even make use of Python GUI using Tkinter.

You can find all the code at my GitHub Repository. Drop a star if you find it useful.

Thank you for reading, I would love to connect with you at Twitter | LinkedIn.

Do share your valuable suggestions, I appreciate your honest feedback!

You should definitely check out my other Blogs:

Resources:

See you in my next Blog article, Take care!!

Sai Laasya Vabilisetty's photo

I always admire the way you learn and share!! Awesome article😍

Rahul's photo

Best Post and useful for Many people 😂😂😂

Ayushi Rawat's photo

Glad you found it Useful!

DesignerAnna1's photo

Excercise has done. 👍 Screenshot 2020-11-28 at 4.47.32 PM.jpg

DesignerAnna1's photo

Thanks for letting us know about such a useful python module. :)

Ayushi Rawat's photo

Glad to know you liked it!

Husain Gadiwala's photo

Hello, I've been reading your blog's since you uploaded the "automate ms teams" blog. I just want to say I am a huge fan and a learning python enthusiast. Thank you so much for the amazing content that you post :)

bloc kent's photo

Survey.Bertuccis.com – If you had as of late dining at the Bertucci’s, at that point here is a piece of good news for you.

Cause you can get Free Bertucci’s Validation Code for imparting your experience to Bertucci’s Survey.

Along these lines, go to the official site of Bertucci’s Customer Satisfaction Survey and you have a chance to share your real opinion regarding the restaurant food quality and customer service. humansurvey.xyz/survey-bertuccis-com

Jigyasu's photo

You are so good. I am new to both Python and Hashnode as well and I find your small tutorials like these so helpful and fun and easy to follow.

I have followed many of your tutorials and they are all great.

Thanks for writing these :)