VOOZH about

URL: https://www.geeksforgeeks.org/python/introduction-to-instaloader-module-in-python/

⇱ Introduction to Instaloader module in Python - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Introduction to Instaloader module in Python

Last Updated : 27 Jan, 2023

The Instaloader module is a Python package having great functionalities to scrap instagram, it's functions can be used as command-line utility. The Instaloader key is used to download:

  • Posts of public/private account
  • stories
  • IGTV
  • Comments on post
  • Profile information
  • Story highlights

The instaloader module can be used to download everything of profile/Instagram user, you need to interrupt by CONTROL+C to kill the process. However, for downloading files of a private account, you must log in, there is no compulsion for a public account. Also, comments are in json file which is zipped as a folder. 

Installation:

 pip install instaloader

Implementation:

Download everything about a profile:

instaloader geeks_for_geeks

On using this command your program will download everything about profiles. For public account, it will download stories, post, highlights news. For private, it only downloads profile photo and other public information about profile. 

Output:

👁 Image

Download highlights of a particular profile:

instaloader --highlights geeks_for_geeks

Output:

👁 Image

The above command downloads public highlights of a particular profile

Download through Hashtag:

instaloader "#hashtag" coding_memes

Output:

👁 Image

The above command downloads posts having a given Hashtag.

Download IGTV videos

instaloader --igtv geeks_for_geeks

Output:

👁 Image

The above command is used to download videos of a particular profile on instagram in .mp4 format.

Profile class can be used to access metadata of profile

Attributes of Profile class:

followers

 It returns the number of accounts following the given account

Output:

👁 Image

followees

It returns the number of accounts followed by given account

Output:

👁 Image
Number of followees of this profile

mediacount

It returns the total number of posts

Output:

👁 Image
Total number of media count

igtvcount

It returns the total number of igtv posts

Output:

8

is_private

It  tells whether account is private or not

Output:

False

biography

It returns the description/ bio of the account

Output:

👁 Image
Biography of this profile using biography attributes

profile_pic_url

It returns the link to the profile picture of the account

Output:

👁 Image
Profile picture image url

external_url

It returns the external url (if any)

Output:

👁 Image
External link through Instagram

is_business_account

It tells whether the account is a business account or not

Output:

True

business_category_name

It returns the type of business account is associated with

Output:

👁 Image
Business category name of this profile

NOTE : Profile class objects have many more properties and functions to scrap Instagram profile metadata. A list of all the properties and functions of the Profile class object can be obtained using dir() function. 

Comment
Article Tags:
Article Tags: