instauto
is a Python package for automating Instagram, making use of the private Instagram API. instauto
tries to have feature parity with the Instagram app.
Instauto has 3 main api's that can be used: instauto.api
, instauto.bot
and instauto.helpers
. You should probably use instauto.helpers
and only start using instauto.api
when you actually need its functionality.
Everything in instauto
, is based around the 'core' instauto.api
package. This package interacts directly with the private Instagram API and contains all functionality. This package is both the most flexible (you can update all requests sent and receive the full response back, for example), but also the most complex. You likely do not need to use this package.
The instauto.helpers
package, is an abstraction above the instauto.api
pacakge. It offers a little bit less flexibility, but is a lot less complex to use. It also offers typed models.
The instauto.bot
package, is another abstraction, but this time over the instauto.helpers
package. This package has pretty much no flexibility, but can be set up in 10 lines of Python code.
The package can be installed with the following pip command:
pip install instauto
Below are a few examples for getting stared quickly. After getting started, you'll probably want to take a quick look at the more detailed documentation on readthedocs.
You'll want to do this as little as possible. Instagram sees logging in often as a huge red flag.
from instauto.api.client import ApiClient
client = ApiClient(username='your_username', password='your_password')
client.log_in()
Because of that, you can restore your session.
client.save_to_disk('your-savefile.instauto')
client = ApiClient.initiate_from_file('your-savefile.instauto')
Ofcourse instauto
also supports (un)following users.
from instauto.helpers.friendships import follow_user, unfollow_user
follow_user(client, username='stan000_')
unfollow_user(client, username='stan000_')
But before you can follow users, you'll need to find them first.
from instauto.helpers.search import search_username
users = search_username(client, "username", 10)
Getting a list of users that follow you is also super simple.
from instauto.helpers.friendships import get_followers
followers = get_followers(client, username='your_username', limit=100)
instauto
also offers a simple API for uploading images to your feed and story.
from instauto.helpers.post import upload_image_to_feed
upload_image_to_feed(client, './cat.jpg', 'Hello from instauto!')
Your feed can't be missing, it's pretty much what Instagram is about, isn't it?
from instato.helpers.feed import get_feed
posts = get_feed(client, 100)
Looking for something else? We have more examples:
- feed helper functions
- friendship helper functions
- post helper functions
- search helper function
- advanced examples
Stil no look? Submit a feature request!
- Scraping Instagram API with Instauto: https://www.trickster.dev/post/scraping-instagram-api-with-instauto/
- How I made an instagram bot that posts a quote every day: https://joaoramiro.medium.com/how-i-made-an-instagram-bot-that-publishes-a-post-every-day-cc49e526bc54
This is a hobby project, which means sometimes other things take priority. I will review issues and work on issues when I have the time. Spamming new issues, asking for a ton of updates, or things like that, will not speed up the process. It will probably even give me less motivation to work on it :)
If you're looking for paid support, please reach out to me at stanvanrooy6@gmail.com.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
There's an article up on the wiki, that explains how to set up a development environment.
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!