Justin Sapun, justin.sapun.th@dartmouth.edu

With increased personalization across various apps and social media, I found it surprising that you weren’t able to automatically change your profile picture. I understand on the backend this feature could complicate database storage matters and could be unnecessarily taxing on the servers. Nevertheless, I decided to create my own slideshow implementation on Instagram that would cycle through a pre-selected set of personal images.

Necessary Components

  • Raspberry Pi 3 A+ and power supply

  • MicroSD

  • MicroSD Card Reader/Imager

  • Instagram account

Implementation


The biggest advantage of a Raspberry Pi is that it acts like an affordable miniature computer. With this, you can create your own server. The Pi would act like a continuously running machine, executing whatever whenever you want. The Pi would have to access an Instagram account to change the profile picture, but how? Like most online services that store information, Instagram has an API, or it used to. As Meta acquired Instagram, they consolidated their API into the Facebook API. I’ve found this API to be overburdensome as it requires an app to be built for its use and post-authorization. Instead, I choose to use Selenium, a browser automation software tool. Then, the script would start the browser, log into the Instagram account, change the profile picture, and then close the browser. The script was consistently running in the background. See the source code on GitHub below:



Remote Server

During development, I didn’t have a monitor or keyboard so I had to set it up as a Headless Pi. Meaning I would ssh into the Pi and access directories and apps remotely. This would later serve to my advantage because I could access the PI on my local network and globally anywhere in the world through the internet. Obviously, you need Wifi admin access to be able to set up port forwarding and special encrypted access. More detailed information can be found in the GitHub.

Instagram Bot

Using Selenium and its automated browser, I was able to replicate similar commands sent to web servers that would allow the Pi to log in with my credentials, go to profile settings, and upload a new photo from the image directory. The matter of finding these HTML components can be tedious as you have to use Chrome Dev Tools.


Considerations

Challenges arise when trying to change profile pictures consistently on new accounts or too frequently. As bot detection is prevalent on most online platforms, Instagram is no exception and consistently banned multiple test accounts. Naively, I initially tested this program on my personal account with a 5-minute slideshow. I got a warning within a couple of hours and promptly stopped the script. It seems obvious now that someone should increase and alter the duration.

Skills


This project gave me more experience with the command line interface, requiring me to modify and build this automation remotely. I also developed skills in web automation and server management.