Convert movie or show titles/names to IMDB IDs.
This program takes in a text file (.txt
) containing movie and show titles (one per line), queries IMDB search to get their IMDB IDs, and saves results to a CSV file (.csv
).
I needed to transfer two of my personal lists (watched movies and movies I'd like to watch) saved in text files to Trakt. I found Trakt.tv tools which does exactly that but it requires IMDB IDs instead of movie names. Fortunately, there is an existing package created by ebouther that converts a movie or show title to its respective IMDB ID. I simply utilize his tool to convert a text file full of movie and show titles to IMDB IDs.
- Get a Terminal: cmd (Windows), Terminal (macOS), or Console (Linux)
- Install Node.js, either LTS or Current.
- Clone or download this repository
git clone https://github.com/Prince25/Titles-To-IMDB-IDs.git
- Go to root directory
cd Titles-To-IMDB-IDs
- Install npm packages via a terminal
npm install
Run node main.js <Text File>
.
Replace <Text File>
with the text file containing the movie or show titles to convert.
main.js
contains additional configurable options:
DELAY
: Delay in milliseconds between IMDB search queries. Default:1000
. Be careful to not set this too low.OUTPUT_FILE
: The name of the output CSV file containing the titles, IMDB IDs, and IMDB URLs. Default:imdb_ids
.ERROR_FILE
: The name of the error CSV file containing the titles which failed to be converted as well as the error message and the attempted IMDB search query URL. Default:errors
.
Upon run, a OUTPUT_FILE
CSV containing the respective IMDB IDs will be generated. If some titles failed to convert, a ERROR_FILE
CSV will be created as well.
An example text file, example.txt
, is provided for demonstration. Running
npm run example
OR
node main.js example.txt
will generate imdb_ids.csv
and errors.csv
.
See the LICENSE file for license rights and limitations (MIT).