New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

imdb-search

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imdb-search

A wrapper on omdb module to easy select correct wanted item with all info

latest
Source
npmnpm
Version
0.1.5
Version published
Maintainers
1
Created
Source

NPM

A wrapper on omdb module to easy select correct wanted item with all info
Use ES6 Promise for search and get a title info.

Installation

with npm:

$ npm install --save imdb-search    

or with yarn:

$ yarn add imdb-search

Example

const imdb = require('imdb-search');

// Search for a Movie, result is an array of movies
imdb.search('Doctor Strange')
  .then(result => {
    for (let movie of result) {
      console.log(`${movie.id}: ${movie.title} - ${movie.year}`);
    }
  })
  .catch(err => {
    console.log(err);
  });

// We can pass year and type as optional args to get right result
// Because of omdb dependency movies can have this types: `series, movie, episode`
imdb.search('Doctor Strange', 2016, 'movie')
    .then(result => {
      for (let movie of result) {
        console.log(`${movie.id}: ${movie.title} - ${movie.year}`);
      }
    })
    .catch(err => {
      console.log(err);
    });

// We can select item number in returned result
imdb.search('Doctor Strange', 2016, 'movie')
  .then(result => {
    return imdb.get(0); // Select first movie on the list
  })
  .then(movie => {
    console.log(`${movie.title} - ${movie.year}`);
  })
  .catch(err => {
    console.log(err);
  });


// Get a movie with imdb id
imdb.get('tt1211837')
  .then((movie) => {
    console.log(`${movie.title} - ${movie.year}`);
  })
  .catch((err) => {
    console.log(err);
  });

Methods

search(name[, year, type])

Use this method to search on imdb with name, you can pass year and type as optional arguments.
Search method return an array of movies.

Note: Each item of search array have one field namedid(internal id), use this id to get more info.

get(id)

Use this method to get a movie from the list of movies on the last search

Note: id value can be an internal id or imdb specific id.

Keywords

imdb

FAQs

Package last updated on 05 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts