Skip to main content

Automate Your Instagram account using Python in less than 10 lines of code

Prerequisite Requirements :

Python latest version: https://www.python.org/downloads/

Firefox: https://www.mozilla.org/en-US/firefox/new/

Selenium Tool: https://selenium-python.readthedocs.io/installation.html

Installation :

Open CMD in windows

Type this command ''pip install instapy"

Or 

You can visit this website for installation: https://pypi.org/project/instapy/

After entering the command just click "Enter" it will automatically install all required files

After installation completed open a new file and save it as 'anyname'.py

Open the file with any editor and type the below code

" Quickstart script for InstaPy usage "
# imports
from instapy import InstaPy
from instapy import smart_run

# login credentials
insta_username = 'developerstruggle'  # <- enter username here
insta_password = ''  # <- enter password here

session = InstaPy(username=insta_username,
                  password=insta_password,
                  headless_browser=False)

with smart_run(session):
    # general settings
    session.set_relationship_bounds(enabled=True,
                                    delimit_by_numbers=True,
                                    max_followers=4590,
                                    min_followers=45,
                                    min_following=77)

    session.set_comments(['Nice shot!','Great Shot'])
    session.set_do_comment(enabled=True, percentage=80)
    session.like_by_tags(["natgeo"], amount=10)
    

Save the file and run the script. Boom! firefox will be opened the bot will run automatically

For more templates of the automation visit this site: https://github.com/InstaPy/instapy-quickstart/tree/master/quickstart_templates

To know more options of the tool, visit this site: https://instapy.org/actions

Comment below, If you are facing any issue 

Thanks for reading. Cheers !! 



Comments