{"id":16064430,"url":"https://github.com/lacymorrow/movie-trailer","last_synced_at":"2025-03-16T08:32:06.469Z","repository":{"id":16658326,"uuid":"19413851","full_name":"lacymorrow/movie-trailer","owner":"lacymorrow","description":"📽  Fetch movie trailers: \"Crash\" ➔ http://path/to/trailer","archived":false,"fork":false,"pushed_at":"2023-10-31T19:34:39.000Z","size":368,"stargazers_count":34,"open_issues_count":3,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-29T10:30:11.918Z","etag":null,"topics":["api","callback","cli","javascript","lookup","movie","movie-trailer","nextjs","node","npm","react","tmdb","trailer"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/movie-trailer","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lacymorrow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":"lacymorrow","patreon":"lacymorrow","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":"https://www.buymeacoffee.com/lm"}},"created_at":"2014-05-03T23:01:17.000Z","updated_at":"2024-05-27T12:03:21.000Z","dependencies_parsed_at":"2023-11-09T16:02:41.980Z","dependency_job_id":"f38e5ebd-ac07-4639-b89b-1b1f93893a69","html_url":"https://github.com/lacymorrow/movie-trailer","commit_stats":{"total_commits":76,"total_committers":8,"mean_commits":9.5,"dds":0.2763157894736842,"last_synced_commit":"4185e9fa6b30fb119a91d3094a17d150b7aa919e"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lacymorrow%2Fmovie-trailer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lacymorrow%2Fmovie-trailer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lacymorrow%2Fmovie-trailer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lacymorrow%2Fmovie-trailer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lacymorrow","download_url":"https://codeload.github.com/lacymorrow/movie-trailer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242693282,"owners_count":20170414,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","callback","cli","javascript","lookup","movie","movie-trailer","nextjs","node","npm","react","tmdb","trailer"],"created_at":"2024-10-09T05:07:44.652Z","updated_at":"2025-03-16T08:32:06.131Z","avatar_url":"https://github.com/lacymorrow.png","language":"JavaScript","funding_links":["https://github.com/sponsors/lacymorrow","https://patreon.com/lacymorrow","https://www.buymeacoffee.com/lm","https://www.patreon.com/bePatron?u=55065733"],"categories":[],"sub_categories":[],"readme":"\u003e [!IMPORTANT]  \n\u003e This library is considered **feature-complete** and will only receive updates for bug fixes. You may still create an issue if you have a feature request.\n\n# movie-trailer [\u003cimg src=\"https://github.com/lacymorrow/crossover/raw/master/src/static/meta/patreon-button.webp\" style=\"height:40px;\" height=\"40\" align=\"right\" /\u003e](https://www.patreon.com/bePatron?u=55065733)\n[![npm version](https://badge.fury.io/js/movie-trailer.svg)](https://badge.fury.io/js/movie-trailer) [![Maintainability](https://api.codeclimate.com/v1/badges/8dce3031d73c7beb9c98/maintainability)](https://codeclimate.com/github/lacymorrow/movie-trailer/maintainability) [![Try movie-trailer on RunKit](https://badge.runkitcdn.com/movie-trailer.svg)](https://npm.runkit.com/movie-trailer)\n\n\u003e Fetch movie trailer url(s): \"Oceans Eleven\" ➔ https://www.youtube.com/watch?v=...\n\n[![movie-trailer](https://github.com/lacymorrow/movie-trailer/raw/master/demo.svg?sanitize=true)]()\n\n#### [Try it on RunKit](https://runkit.com/lacymorrow/movie-trailer) _([Output](https://runkit.io/lacymorrow/movie-trailer/branches/master?search=Avatar))_\n\n\n## Features\n * Fetch Youtube trailers for any movie or TV show\n * Return one or many trailer URLs\n * Use anywhere, browser or Node - UMD _([Browser Support](https://caniuse.com/#feat=fetch))_\n * Works in React + NextJS client/server (uses [isomorphic-fetch](https://www.npmjs.com/package/isomorphic-fetch))\n * Async/await, Promise and Callback APIs\n\n\n## Install\n\nUsing [NPM](https://npmjs.com):\n\n```bash\nnpm install --save movie-trailer\n```\n\nIn the browser:\n\n```html\n\u003c!-- movieTrailer window global --\u003e\n\u003cscript type=\"text/javascript\" src=\"https://unpkg.com/movie-trailer\"\u003e\u003c/script\u003e\n```\n(via Unpkg, or via [JSDelivr](https://cdn.jsdelivr.net/npm/movie-trailer/index.min.js))\n\n\n## Usage\n\n```js\nconst movieTrailer = require( 'movie-trailer' ) // or import movieTrailer from 'movie-trailer'\n\nawait movieTrailer( 'Up' )\n//=\u003e https://www.youtube.com/watch?v=...\n```\n\n##### TV Shows\n```js\nmovieTrailer('Shameless', {videoType: 'tv'})\n//=\u003e https://www.youtube.com/watch?v=...\n```\n\n##### Return an array of video IDs\n```js\nmovieTrailer( 'Oceans Eleven', {id: true, multi: true} )\n  .then( response =\u003e console.log( response ) )\n  \n//=\u003e [ 'XXXXXXXXX', 'XXXXXXXXX', ... ]\n```\n\n##### Both\n```js\nmovieTrailer( 'Oceans Eleven', {year: '1960', multi: true} )\n  .then( response =\u003e console.log( response ) )\n\n//=\u003e [ https://www.youtube.com/watch?v=XXXXXXXXX, ... ]\n```\n\n##### Legacy-style search using release date year\n```js\nmovieTrailer( 'Oceans Eleven', 1960 )\n  .then( response =\u003e console.log( response ) )\n\n//=\u003e http://path/to/trailer\n```\n\n## API\n\n### movieTrailer(movie [, options ] [, callback])\n\n* #### movie\n\n\t**Required**\n\n\tType: `string`\n\n\tMovie to search for. If searching with a `tmdbId`, pass `null`.\n\n\n* #### options \n\n\tType: `object`\n\n\t* ##### `apiKey`\n\n\t\tType: `string` \n\n\t\t_(optional)_ Use your own TMDB api key. You can get a free key here: https://developers.themoviedb.org/ .\n\n\t\t_Use `-a` or `--api_key` on the CLI_\n\n\t* ##### `id` _(`false`)_\n\n\t\tType: `boolean` \n\n\t\t_(optional)_ Return only Youtube video IDs.\n\n\t\t_Use `-i` or `--id` on the CLI_\n\t\t\n\t\n\t* ##### `language`\n\n\t\tType: `string` (_language code_)\n\n\t\t_(optional)_ Movie release language.\n\n\t\t_Use `-l` or `--language` on the CLI_\n\t\t\n\n\t* ##### `multi` _(`false`)_\n\n\t\tType: `boolean` \n\n\t\t_(optional)_ Return an array of urls vs a single url.\n\n\t\t_Use `-m` or `--multi` on the CLI_\n\n\t\t```js\n\t\tmovieTrailer( 'Oceans Eleven', { multi: true } )\n\t\t```\n\n\t* ##### `tmdbId`\n\n\t\tType: `string` || `number` \n\n\t\t_(optional)_ Search using a TMDB content ID instead of a search term\n\n\t\t_Use `-t` or `--tmdb_id` on the CLI_\n\n\t\t```js\n\t\tmovieTrailer( null, { tmdbId: 161 } )  // Content ID for \"Ocean's Eleven\"\n\t\t```\n\n\t* ##### `year`\n\n\t\tType: `string` || `number`\n\n\t\t_(optional)_ Movie release year.\n\n\t\t_Use `-y` or `--year` on the CLI_\n\n\n* #### callback(error, response)\n\n\tCallback function.\n\n\t```js\n\tmovieTrailer( 'Oceans Eleven', ( error, response ) =\u003e {\n\t    console.log( response ); \n\t    //=\u003e http://path/to/trailer\n\t} )\n\t```\n\n\n#### From the command line\n\n```bash\n$ npx movie-trailer --help\n\nUsage\n\t$ npx movie-trailer movie \t\n\nOptions\n\t--api_key   -k   (optional) Your own TMDB API key: http://developers.themoviedb.org\n\t--id        -i   Return just the Youtube video ID.\n\t--language, -l   Specify a language code (eg: 'de_DE').\n\t--multi,    -m   Returns an array of URLs instead of a single URL.\n\t--tmdb_id   -t   Specify an explicit TMDB ID.\n\t--year,     -y   Specify a release year to search.\n\nExample\n\t$ npx movie-trailer 'Oceans Eleven' -y 1960 -m\n\t//=\u003e http://path/to/trailer\n```\n\n\n## Related\n\n* [album-art](https://github.com/lacymorrow/album-art)\n* [movie-art](https://github.com/lacymorrow/movie-art)\n* [movie-info](https://github.com/lacymorrow/movie-info)\n\n\n## License\n\nThis package uses data from TMDB. You may consult [TMDB terms of service](https://www.themoviedb.org/documentation/api/terms-of-use) for usage rights.\n\n[MIT](http://opensource.org/licenses/MIT) © [Lacy Morrow](http://lacymorrow.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flacymorrow%2Fmovie-trailer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flacymorrow%2Fmovie-trailer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flacymorrow%2Fmovie-trailer/lists"}