movie.js

3.3.5 • Public • Published

Movie.js

NPM downloads License Vulnerabilities

An advanced api wrapper for the OMDB API

Features:

  • Lightweight - Only one dependency
  • Object-oriented
  • Promise and async/await support
  • Easy-to use syntax
  • Advanced error handling - Catch errors before you send them to the API
  • 100% API support - The whole OMDB API is documented and covered
  • High-level api - start hacking in just a few lines!

Installation

npm install movie.js

Usage

const movieJs = require("movie.js");
const movies = new movieJs(process.env.API_KEY); // API key goes here

Wrap the following code in an await function to use async/await. More info

Search for movies

await movies.search("Star Wars"); // Search for star wars movies

await movies.search("Star Wars", { // Search with options
	type: "", // Either movie, series, or episode
	year: 1999, // Shows search results of movies released that year 
	page: 1, // Pagination 1-100
}); 

Get movie by IMDB ID

await movies.get("tt1285016"); // Get movie by ID

await movies.get("tt1285016", { // Get movie by ID with options
	plot : "full", // Whether to return a "short" or "full" plot
});

const movie = await movies.search("Star Wars"); // Search for a movie
await movies.get(movie[0]); // Get more info on the first movie

Get movie by title

await movies.getByTitle("Good Burger"); // Get movie by title

await movies.getByTitle("Good Burger", {
	plot: "full", // Whether to return a "short" or "full" plot
	type: "movie", // Either movie, series, or episode
	year: 1997, // What year the returned movie should be
});

Get movie poster

await movies.getPoster("tt1285016"); // Get poster image as a buffer 

License

MIT

Package Sidebar

Install

npm i movie.js

Weekly Downloads

3

Version

3.3.5

License

MIT

Unpacked Size

15.3 kB

Total Files

6

Last publish

Collaborators

  • the-galaxy