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 🙏

© 2026 – Pkg Stats / Ryan Hefner

movie-trailer

v3.2.3

Published

Get movie & TV trailer url(s): Oceans Eleven ➔ http://path/to/trailer

Downloads

1,521

Readme


[!IMPORTANT] This library is feature-complete and only receives bug-fix updates. Feature requests still welcome — please open an issue.

Features

  • Fetch YouTube trailers for any movie or TV show
  • Return one URL or many — videos, IDs, or full URLs
  • Async/await, Promise, and callback API
  • Use anywhere — browser or Node, UMD bundle (browser support)
  • Works in React + Next.js, client and server, via isomorphic-fetch
  • Bring your own TMDB API key, or use the default

Install

npm install movie-trailer

In the browser:

<!-- movieTrailer as a window global -->
<script src="https://unpkg.com/movie-trailer"></script>

Also available via JSDelivr.

Usage

const movieTrailer = require("movie-trailer");
// or: import movieTrailer from "movie-trailer";

await movieTrailer("Up");
//=> https://www.youtube.com/watch?v=...

TV shows

await movieTrailer("Shameless", { videoType: "tv" });
//=> https://www.youtube.com/watch?v=...

Many trailers — IDs only

await movieTrailer("Oceans Eleven", { id: true, multi: true });
//=> ["XXXXXXXXX", "XXXXXXXXX", ...]

Year disambiguation + multiple URLs

await movieTrailer("Oceans Eleven", { year: "1960", multi: true });
//=> ["https://www.youtube.com/watch?v=...", ...]

Legacy positional year

await movieTrailer("Oceans Eleven", 1960);
//=> https://www.youtube.com/watch?v=...

[!TIP] Try it live — open in RunKit (example output).

API

movieTrailer(movie [, options] [, callback])

Pass a movie or show title (or null if searching by tmdbId). Returns a Promise that resolves to a YouTube URL — or an array of URLs / IDs depending on options.

| Option | Type | Default | Description | |---|---|---|---| | apiKey | string | TMDB default | Use your own TMDB key — get one free | | id | boolean | false | Return only YouTube video IDs (e.g. "abc123" instead of full URLs) | | language | string | | Movie release language code (e.g. "de_DE") | | multi | boolean | false | Return an array of results instead of a single result | | tmdbId | string \| number | | Search by TMDB content ID instead of a title (pass null as the first argument) | | year | string \| number | | Release-year disambiguator | | videoType | "movie" \| "tv" | "movie" | Movie or TV search |

The third argument may also be a Node-style (err, response) => void callback.

Search by TMDB ID

await movieTrailer(null, { tmdbId: 161 });  // Ocean's Eleven

CLI

npx movie-trailer --help
#  Usage
#    $ npx movie-trailer movie
#
#  Options
#    --api_key, -k   Your own TMDB API key
#    --id,      -i   Return just the YouTube video ID
#    --language,-l   Language code (e.g. 'de_DE')
#    --multi,   -m   Return an array of URLs
#    --tmdb_id, -t   Search by TMDB ID
#    --year,    -y   Release year
#
#  Example
#    $ npx movie-trailer 'Oceans Eleven' -y 1960 -m
#    => https://www.youtube.com/watch?v=...

Related

Part of a small family of media-data utilities:

  • album-art — Fetch album and artist cover art.
  • movie-art — Get the poster art for a movie.
  • movie-info — Get info, images, and ratings about a movie.

Acknowledgments

License

MIT © Lacy Morrow