TMDb-async-client is a native Scala SDK that provides asynchronous access to The Movie Database (TMDb) API.
It is built heavily on akka-http for async non-blocking HTTP I/O and spray-json for parsing JSON responses into Scala case classes.
akka-stream is used to allow limitation of client request frequency and number of parallel requests in respect of TMDb policies.
TMDb-async-client is an EDLA project.
The purpose of edla.org is to promote the state of the art in various domains.
You will need an API key to The Movie Database to access the API. To obtain a key, follow these steps:
- Register for and verify an account.
- Log into your account
- Select the API section on left side of your account page.
- Click on the link to generate a new API key and follow the instructions.
See Usage.scala for a runnable example.
Each function returns a
Future of the response from the TMDb API, parsed into a convenient case class.
val apiKey = "REPLACE_THIS_WITH_YOUR_OWN_API_KEY" val tmdbClient = TmdbClient(apiKey) val movie = tmdbClient.getMovie(54181) val movies = tmdbClient.searchMovie("shark") tmdbClient.downloadPoster(movie, Paths.get("/tmp/poster.jpg")) tmdbClient.shutdown
API Key need to be available as an environment variable named apiKey if you want to run sbt test
© 2014-2021 Olivier ROLAND. Distributed under the GPLv3 License.