series-word-freq
v1.0.4
Published
## Magically create interactive graphs of word frequency in a TV series
Readme
series-word-freq
Magically create interactive graphs of word frequency in a TV series
Uses the OpenSubtitles API to download subtitle files for a series then we analyse the frequency of words in the subtitles to create an interactive graph of word frequency.
Table of Contents
1. Story behind this project
2. Usage
3. Screenshots
4. OpenSubtitles API
Story behind this project
I saw this Reddit post which I found intriguing. I wanted to see if I could create something similar but for any TV series.
I decided to aim at a deadline of 2 hours to complete a simple MVP implementation of this project idea from start at 1:30am finishing at 3:30am. I managed to complete the project in 7 hours and 30 minutes finishing at 9:00am. I am very happy with the result and I hope you find it useful.
"Work expands so as to fill the time available for its completion" - Parkinson's Law
Usage
Install Node.js (https://nodejs.org/)
Clone this repository
git clone [email protected]:martinshaw/series-word-freq.gitor download the zip file and extract it.Install the dependencies by running
npm installin the project directory.Run
npm run swf loginto login to the OpenSubtitles API. You will need to create an account at https://www.opensubtitles.org/ and get a username, password and an API key. You will be prompted to enter these details or you can add them manually to a.envfile. Choose a password that doesn't contain double quotes.Run
npm run swf search "series"to search for a series. Replaceserieswith the name of the series you want to search for.Browse through the shows using
nandpto move to the next and previous pages. When you find the show you want, presss. Pressqto quit.Run the mentioned command
npm run swf extract 12345to extract the subtitles for the show. Replace12345with the ID of the show you want to extract.Run the mentioned command
npm run swf download 12345to download the subtitles for the show.Run the mentioned command
npm run swf analyse 12345to analyse the subtitles for the show.Run the command
npm run swf chart 12345to generate a .png image of the word frequency graph for the show.Run the command
npm run swf interactive 12345to serve an interactive word frequency graph for the show on a local server at http://localhost:5000.Run the command
npm run swf lsornpm run swf listto list the shows you have analysed.
Screenshots
| Login | Search | Extract | Download | Analyse | Chart |
| --- | --- | --- | --- | --- | --- |
|
|
|
|
|
|
|
OpenSubtitles API
If you need more help setting up series-word-freq with the OpenSubtitles API. Please follow these simple steps:
- Create an account at https://www.opensubtitles.org/

- Login to your account and go to the 'API Consumers' page.

- Create a new API Key (Consumer). If you are using this for development etc..., you should tick 'Under dev' as this gives you a generous limit of download requests.

