npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

omdb-js

v1.0.0

Published

A wrapper for OMDB API in JS

Readme

omdb-js

omdb-js is a wrapper for the popular OMDB API.

Table of Contents

  1. Why
  2. Features
  3. Installing
  4. Configuration
  5. Usage
  6. Contributing

Why

I used OMDB API for a recent application and found it to be a handy little API. There were no wrappers for it, so I made one!

Features

  • searchForMovie: Using a fuzzy search, get an array of movie objects that best match the title you enter into the method.

  • getSpecificMovie: Ask OMDB API for a single movie result. If you pass a title into the method (instead of an imdbId), the returned movie will be the movie with the closest matching title.

  • configure: Configure omdb-js to run with specified settings at each call. More details on these parameters can be found here: http://www.omdbapi.com/.

Installing

In terminal, within your project's directory tree run the following command:

npm install --save omdb-js

Configuration

To use omdb-js, you will need to pass your OMDB API key (string) into it when it is require'd into your project.

const omdb = require('omdb-js')(OMDB_API_KEY);

API

searchForMovie(title, options)

Purpose

Utilize OMDB API's native fuzzy searches to find a number of movies whose titles resemble that of the string passed to the method. This will return an array of potentially matching movie objects.

Arguments

  1. title (required) - type: string - info: the name of the movie you are searching for.
  2. options: - type: object - info: An options object that will temporarily override any options set through the configure method. - properties:
    • type: (string)
      • valid options: "movie", "episode", "series"
      • info: The kind of IMDB entry you are searching for.
    • y: (string)
      • info: The year of the item you are searching for
    • r: (string) The response type
      • valid options: 'json', 'xml'
      • default: 'json'
    • page: (number 1-100)
      • info: the page number of search results you want
      • default: 1
    • callback: (string)
      • info: A jsonp callback function name

Example:

omdb.searchForMovie('Star Wars', {
  type: 'movie',
  y: '1977',
  r: 'json',
  page: 1
}).then(results => {
  // results is an array of movie objects
})

getSpecificMovie(title, imdbId, options)

Purpose

Find the closest matching movie for the title passed to the method. This will return a single movie object.

Arguments

  1. title (this OR imdbId required) - type: string - info: the name of the item you are searching for.
  2. imdbId (this OR title required)
  • type: string
  • info: the imdbId of the item you are searching for.
  1. options: - type: object - info: An options object that will temporarily override any options set through the configure method. - properties:
    • plot: (string)
      • valid options: "full", "short"
      • default: "full"
    • type: (string)
      • valid options: "movie", "episode", "series"
      • info: The kind of IMDB entry you are searching for.
    • y: (string)
      • info: The year of the item you are searching for
    • r: (string) The response type
    • page: (number 1-100)
      • info: the page number of search results you want
      • default: 1
    • callback: (string)
      • info: A jsonp callback function name

Example

omdb.getSpecificMovie('Mad Max Fury Road', {
  plot: 'short',
  type: 'movie',
  y: '2015',
  r: 'json',
  page: 1
}).then(result => {
  // result is a single OMDB API json object json matching the year and title, with "short" plot summary
})

configure(options)

Purpose

Configure all future omdb-js requests to use the options specified. Some options do not apply to certain searches, e.g. there is no "plot" option in the base searchForMovie method, since that method returns small movie objects by default.

Arguments

  1. options (required) - type: object - properties:
    • plot: (string)
      • valid options: "full", "short"
      • default: "full"
    • type: (string)
      • valid options: "movie", "episode", "series"
      • info: The kind of IMDB entry you are searching for.
    • r: (string) The response type
    • page: (number 1-100) The page number of search results you want
    • callback: (string) -info: A jsonp callback function name

Example

omdb.configure({
  plot: 'short',
  r: 'xml',
  page: 2,
  type: 'episode'
});

Future omdb function invocations will return xml,
page 2, and search for episodes from IMDB rather than movies. 

In searches that return full movie objects, e.g. getSpecificMovie,
the plot descriptions will be short.

Built With

  • Axios - A powerful, easy-to-use handler for http requests.

Contributing

Please read CONTRIBUTING.md for details on the code of conduct and the process for submitting pull requests.

Contributors are welcome and will be clearly acknowledged.

License

This project is licensed under the MIT License - see the LICENSE.md file for details