This is a wrapper around the TMDb API.
```rust extern crate tmdb;
use tmdb::model::; use tmdb::themoviedb::;
fn main() { let tmdb = TMDb { apikey: env!("TMDBAPI_KEY"), language: "en" };
let movies = tmdb.search()
.title("Interstellar")
.year(2014)
.execute()
.unwrap();
let id = movies[0].id;
let interstellar = tmdb.fetch()
.id(id)
.execute()
.unwrap();
println!("{:?}", interstellar);
} ```
Currently there are 3 actions available:
You can search for movies by title
and year
.
```rust let page = tmdb.search() .title("Bicentennial Man") .year(1999) .execute() .unwrap();
let movies = page.results; ```
You can fetch a movie, when you know its ID. Then you get all the movie details.
rust
let movie = tmdb.fetch()
.id(157336)
.execute()
.unwrap();
When you don't have any movie ID, you can search for a movie and then easily fetch the full details.
```rust let page = tmdb.search() .title("Bicentennial Man") .year(1999) .execute() .unwrap();
let movies = page.results; let movie = movies[0].fetch(&tmdb).unwrap(); ```
Furthermore you can request some more data with the append to response feature.
rust
let movie = tmdb.fetch()
.id(2277)
.append_videos()
.append_credits()
.execute()
.unwrap();
Finding a movie with an external ID is currently supported with IMDB IDs.
```rust let findresult = tmdb.find() .imdbid("tt0816692") .execute() .unwrap();
let movies = findresult.movieresults; ```
https://www.themoviedb.org/