Appendix A. Indexing directly from TMDB

 

Starting in chapter 3, we used examples from TMDB, The Movie Database. We prepackaged a tmdb.json file for ease of use with the examples. But we’re strong believers in showing your work. In this appendix, we show you how to use the examples with an up-to-date version of TMDB’s data.

We warn you that we have no control over TMDB, so TMDB may make changes to its API or policies that over time make this appendix obsolete. That being said, we also want to add that we’re grateful to TMDB for permission to use its data for this book. We encourage you to visit TMDB (http://themoviedb.org) and make a donation for all their hard work!

This appendix walks you through the following steps:

1.  Obtaining an API key from TMDB

2.  Setting up Python code to talk to TMDB

3.  Pulling back a list of movies, by crawling TMDB’s top-rated movies

4.  Pulling back extended data on each movie

You’re going to set up a process that crawls TMDB for movie IDs and then visits several API endpoints such as /movie/<id> and /movie/<id>/cast to extract extended details for each movie. The code for this can be found in the appendix A IPython notebook examples in the GitHub repo (http://github.com/o19s/relevant-search).

A.1. Setting the TMDB key and loading the IPython notebook

A.2. Setting up for the TMDB API

A.3. Crawling the TMDB API

A.4. Indexing TMDB movies to Elasticsearch