Skip to content

Getting Started With Ensta

Deepak Soni edited this page Jan 8, 2024 · 3 revisions

What is ensta?

Ensta is an open-source python package which you can use to:

  1. Scrape public & private data from Instagram
  2. Take actions on your own Instagram Account (e.g. follow users)

Installation

To install this library using python's package manager, open terminal and run this command:

$ pip install ensta

If you face any problems while using this package, then please make sure you already have the latest version of this package before opening an issue on github or messaging me in discord. To update ensta, run:

$ pip install ensta --upgrade

How to use?

For simplicity, ensta has two classes which you can use: Guest Class and Host Class.

Guest Class

This class doesn't require any type of login and can be used to fetch public data from Instagram. Some examples are:

  1. Fetching profile details of users
  2. Fetching posts of public accounts
from ensta import Guest

guest = Guest()  # no login required

profile = guest.profile("cristiano")  # returns Profile Object

print(profile.follower_count)
print(profile.biography)

Limitations:

Guest class doesn't always work especially if you make too many requests in a short amount of time or your IP Address is flagged by Instagram. To overcome such problems, you may choose any one option out of these two:

  1. Use proxies, specially paid ones as free proxies do not always work.
  2. Use the host class. If you don't want to risk your main account, you can create a dummy account instead and use that in host class.

Host Class

While initialising this class, you need to pass your Instagram username and password as arguments. This class supports a variety of authenticated requests such as:

  1. Changing your bio, name, etc.
  2. Fetching someone's profile details.
  3. Getting details of users followed by a user.
from ensta import Host

host = Host(username, password)  # log into your account

host.follow("cristiano") # returns True or False (successfully followed or not)
Clone this wiki locally