My friends I were joking last night about how we liked to mainline entire seasons of TV via Netflix -- especially while in bed. The thing is, eventually you want snacks, (gummi bears, a fancy soda, maybe a pint of Cherry Garcia). But, you don't want to put on pants, switch apps, go outside, or order the same thing from Seamless again.

Honestly, it's a big missed opportunity for Netflix. They could enable in-app purchasing & drive up revenue a bajillion percent. And in New York, Amazon Prize Now is a pretty great option for delivery. I bet Postmates would work really well too.

So I thought to myself, why not regularly monitor my online viewing activity to determine if I'm marathoning and trigger some helpful alerts / calls-to-action? Imagine getting this text:

Note: my broheim Devin Mancuso and I have been trading browser automation hacks using Python / Selenium and Node/ phantomJS for the past couple weeks, and it's been super fun. If you haven't tried it, you're missing out.

What works

  1. Logging into Netflix account using Selenium & PhantomJS
  2. Parsing activity history with BeautifulSoup
  3. Checking if last 3 shows watched are from same series (marathon) and updating local tinyDB to avoid repeat triggers on same day.
  4. Sending SMS / MMS via Twilio - when marathon conditions are met - with prompt & link to Amazon Prime Now for SNACK DELIVERY, (which is great for Manhattan / NYC)
  5. Light Twitter shaming
  6. Deployed to Digital Ocean & running every 10 minutes via cron.

Console output case 1: new marathon detected (with MMS alert) and case 2: 'old' marathon detected / no alert sent

To do

  1. Add front end for user registration & hide sensitive user data.
  2. Deep links / API integrations for other apps & APIs 'marathon supplies' (Postmates / Seamless / Delivery.com / Amazon Prime now)

Installation & usage

  • First, install the dependencies (and yes, you should really install homebrew)
pip install selenium tinydb twilio beautifulsoup4 python-twitter
brew install phantomjs
  • Then, put your Netflix + Twilio login details & API keys into the keys_ex.py & rename it keys.py (Yeah, I know, I should use env variables, but it was also a really long night.)

  • And finally, run the script

python nflx.py

If you want to run the script regularly, you'll need to write your own cron job - and if you do - I recommend adding some logging.

Share this project:
×

Updates

Neal Shyam posted an update

It took a lot of Google / Stack Overflow magic to get phantomjs working on Digital Ocean. But, once I got it deployed, it was kind of amazing how quickly I racked up binge alerts.

My rock bottom moment: getting alerts @ 10pm and then again at 1am for the same show.

Log in or sign up for Devpost to join the conversation.