8 releases (4 breaking)

Uses new Rust 2021

new 0.5.0 Jun 19, 2022
0.4.0 Jun 4, 2022
0.3.3 Jun 3, 2022
0.3.2 May 17, 2022
0.1.1 Apr 5, 2022

#175 in Database implementations

Download history 71/week @ 2022-03-31 38/week @ 2022-04-07 2/week @ 2022-04-21 37/week @ 2022-04-28 28/week @ 2022-05-05 91/week @ 2022-05-12 28/week @ 2022-05-19 18/week @ 2022-05-26 119/week @ 2022-06-02 9/week @ 2022-06-09 37/week @ 2022-06-16

188 downloads per month

MIT license

24KB
571 lines

The Movie Database

The Movie Database

This is an async wrapper around the TMDb API.

Usage

use tmdb_async::Client;

#[tokio::main]
async fn main() {
	let tmdb = Client::new(env!("TMDB_API_KEY").to_string());
	let search_result = client.movie_search("Interstellar", Some(2014)).await.unwrap();
	let movie = client.movie_by_id(search_result.results[0].id, false, false).await.unwrap();
	println!("{:#?}", movie);
}

Actions

Currently there are 3 actions available:

  • Fetching by ID
  • Searching by name and (optionally) year of release
  • Finding by external ID (IMDb ID, TVDB ID)

Additionally, two media types are currently supported:

  • Movies
  • TV series

Fetching

If you know its ID, you can fetch a movie using that.

let movie = tmdb.movie_by_id(157336).await.unwrap();

You can request some more data with the append to response feature.

let movie = tmdb.movie_by_id(2277, true, true).await.unwrap();

Searching

You can search for movies and series by title and year.

let page = tmdb.movie_search("Bicentennial Man", Some(1999)).await.unwrap();
let movies = page.results;

If you require additional details that aren't returned by the search, you can search then fetch:

let page = tmdb.movie_search("Bicentennial Man", Some(1999)).await.unwrap();
let movie = tmdb.movie_by_id(page.results[0].id, true, true).await.unwrap();

Finding

Finding a movie with an external ID is currently supported with IMDB IDs and, for TV series, TVDB IDs.

let movie = tmdb.movie_by_imdb_id(816692).await.unwrap();

Acknowledgements

Dependencies

~5–14MB
~282K SLoC