The link in my insta bio is for a petition not anything else :)

Inspiration

Reddit post on ideas for a hackathon. I was initially unsure if I should do it but decided to give it a go after the IBM team advised me it would be extremely hard based on their previous experience of making web scrapers on IBM foundry.

What it does

Currently, InstaManager is able to automatically follow the followers of competitors within your niche. It is likely that these users will be interested in your page if it brings something new to the industry and automating the process of unfollowing and following users will help your grow your account with minimal management until such a time it can grow organically, unaided by the bot.

How I built it

I programmed most of the selenium code in python using XPath to reference web elements and OOP to create 'InstagramBot' and 'data' objects. I used the time module to insert random wait periods within the code so that Instagram is less likely to notice the automated actions.

I created two versions as I I kept getting transaction errors using cockroachDB so I switched to SQLite3 to access the database to see if the code actually works and uploaded both sets of code.

Challenges I ran into

As I was advised by the IBM team in the morning, Instagram will block your account if you log in too many times within a single session. I was advised to cache the AUTH cookie as it was valid for 90 days and would allow me to only login once within this period.

To resolve this issue, I scrapped the login method and decided to change the directory that the chrome web driver uses to an identical copy generated for the sole purpose of running the application. This allows Selenium to have access to an identical copy of the chrome cache which in turn allows it to use the same AUTH cookie for the next 3 months - I didn't have enough time to find out how to isolate the AUTH cookie for Instagram by itself.

Accomplishments that I'm proud of

Creating an algorithm for the scroll box and figuring out a way to cache the AUTH cookie which allows the user to retain their login information so that I don't need to worry about encrypting it :)

What I learned

  • How to use Selenium web driver and Cockroach DB.
  • Use of AUTH cookies by websites on chrome.

What's next for Python InstaManager

I will learn how I could've added the other features I intended to include such as scheduling posts and automating predictive comments using artificial intelligence and natural language processing to gauge the context of the comment.

Built With

Share this project:

Updates