Return to Blog Home

Media Quotes

Source Live

Media Quotes

When exactly did that character say that thing in that 200+ episode TV show? Ask no more!

Inspired by seeing TV shows text being used as ways to bypass censorship - someone listing a season, episode, and timestamp of a TV show at which a quote is said instead of the actual quote - I decided to quickly throw together an API to allow these to be easily found.


As The Office is highly quoted, I decided to have that be the first media to add, and obtained SRT subtitles for the entire show, which would serve as the raw dataset. Then I converted these to individual documents to store in my database, and inserted all ~90,000 objects - to my welcome surprise - with a single call to mongodb!

API

The API itself would be relativly simple, allowing user to search for some text and be returned all the quotes containing that text, of course containing the season & episode number along with the timestamp of when it happened.

As a bonus I implemented a random quote endpoint that - to nobodys surprise - returned a random quote object.

Frontend

Thankfully I wrote both of my API methods abstract enough that I could reuse them for my EJS-powered frontend, using the exposed pagination information to create a minimalistic performant UI.