moviedb-wrapper
v0.5.6
Published
A wrapper for The Movie Database
Downloads
6
Readme
Install the package
npm install [email protected]
Getting started
// Add moviedb-wrapper to your code
const MoviesDB = require("moviedb-wrapper");
// Put your api key on the moviedb constructor
// You can get your api key on https://www.themoviedb.org/
const movies = new MoviesDB("api_key");
Get informations
// Get some movie
// Example
// "Project Almanac" will be the query
// And the number will be the page of results
movies.getMovie("Project Almanac", 1).then(val => {
console.log(val)
}).catch(err => console.log(err));
// Get some TV Show
// Example
// "Two and a Half Men" will be the query
// And the number will be the page of results
movies.getTv("Two and a Half Men", 1).then(val => {
console.log(val)
}).catch(err => console.log(err));
// Get some person
// Example
// "Elyes Gabel" will be the query
// And the number will be the page of results
movies.getPerson("Elyes Gabel", 1).then(val => {
console.log(val)
}).catch(err => console.log(err));
// Get the trailer of a movie or tv show
// Example
// 201 will be the id of the movie or tv show
// "movie" will be type
movies.getTrailer(201, "movie").then(val => {
console.log(val)
}).catch(err => console.log(err));
// Get the cast of a movie or tv show
// Example
// 201 will be the id of the movie or tv show
// "movie" will be type
movies.getCast(201, "movie").then(val => {
console.log(val)
}).catch(err => console.log(err));
// Get the recommendations to other movies or tv show's
// Example
// 201 will be the id of the movie or tv show
// "movie" will be type
movies.getRecommendations(201, "movie").then(val => {
console.log(val)
}).catch(err => console.log(err));
// Get the The Movie Database genres.
movies.getGenres().then(val => {
console.log(val)
}).catch(err => console.log(err));
// Get the upcoming movies
// Example
// 1 is the page but is optional
movies.getUpcoming(1).then(val => {
console.log(val)
}).catch(err => console.log(err));
// Works too
movies.getUpcoming().then(val => {
console.log(val)
}).catch(err => console.log(err));
Possible Error's
Error: Invalid API Key
Your API Key is incorrect
Error: What you're looking for was not found
No results fond
Error: type Is not a valid type
Your argument type is not a valid type Valid Types: "tv", "movie"