Garvit Galgat

JUNE 2020 · COLLEGE PROJECT

IPPG

Instagram Profile Picture Grabber

View source

Kotlin · Android · Python · Flask · Selenium · OkHttp · Text files

It was June 2020, during COVID. I was exploring Selenium when I had an idea:

Could I get a user’s profile picture using just their username?

The script

I was an absolute beginner. I kept looking things up on Stack Overflow and trying to make sense of the examples. Somehow I learned to find an element by its class name before I even knew what a class meant in HTML.

After some trial and error, the Selenium script got the picture. Great, it worked! What if I could make an Android app for this?

The app

I didn’t even know I needed a backend. I went back to Stack Overflow to figure out how apps worked and how my Android app could use the scraper. That was how I found out what a backend was and that I needed one here.

What could I use? I already had Python. Flask was recommended as a simple place to start, so I went with it. I was just hacking my way through the problem, looking up whatever I needed next.

Then I had to learn how to turn my script into a REST API and how Android could call it and show the picture. Getting the script to work was one thing. Getting it to work from my phone was a whole new set of questions.

The saved picture

Why fetch the same picture again and again? I stored usernames and images in text files. A little file-based database. It worked here, and dealing with its limitations helped me understand why we usually use an actual database.

I started with a profile picture and ended up learning how an app fits together.