-
-
Notifications
You must be signed in to change notification settings - Fork 46
Getting Started With Ensta
Ensta is an open-source python package which you can use to:
- Scrape public & private data from Instagram
- Take actions on your own Instagram Account (e.g. follow users)
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
For simplicity, ensta has two classes which you can use: Guest Class and Host Class.
This class doesn't require any type of login and can be used to fetch public data from Instagram. Some examples are:
- Fetching profile details of users
- 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)
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:
- Use proxies, specially paid ones as free proxies do not always work.
- 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.
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:
- Changing your bio, name, etc.
- Fetching someone's profile details.
- 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)