Crates.io | tmdb-async |
lib.rs | tmdb-async |
version | 0.7.1 |
source | src |
created_at | 2022-04-04 21:37:43.563544 |
updated_at | 2024-07-24 05:25:42.771743 |
description | The Movie Database (TMDb) API for async Rust |
homepage | https://gitlab.cronce.io/foss/tmdb-rs |
repository | https://gitlab.com/foss/tmdb-rs |
max_upload_size | |
id | 562323 |
size | 75,609 |
This is an async
wrapper around the TMDb API.
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);
}
Currently there are 3 actions available:
Additionally, two media types are currently supported:
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();
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 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();