DEV Community

loading...
Cover image for Download Instagram posts using Python

Download Instagram posts using Python

manitej profile image Manitej ⚡ ・1 min read

In the 2nd post of the series, let's see how to download Instagram posts using Python.

To do this, we need to use a package called instaloader

Installation

Run the below command to install the package

pip install instaloader
Enter fullscreen mode Exit fullscreen mode

Public profile

Let's download this image in this tutorial.

To download an Instagram post of a public account copy the post id from the URL.
if the below is an URL,

https://www.instagram.com/p/CFtle2lpVC1/
Enter fullscreen mode Exit fullscreen mode

The post id will be CFtle2lpVC1

Now, run the below command in the directory you want to download the image.

instaloader -- -(post-id)
Enter fullscreen mode Exit fullscreen mode

Example,

instaloader -- -CFtle2lpVC1
Enter fullscreen mode Exit fullscreen mode

This method only works for public profiles, to learn more visit

Discussion

pic
Editor guide