{"id":13492598,"url":"https://github.com/microlinkhq/youtube-dl-exec","last_synced_at":"2026-02-09T12:14:50.161Z","repository":{"id":38185520,"uuid":"341331841","full_name":"microlinkhq/youtube-dl-exec","owner":"microlinkhq","description":"A simple Node.js wrapper for youtube-dl/yt-dlp.","archived":false,"fork":false,"pushed_at":"2025-05-07T15:04:08.000Z","size":3485,"stargazers_count":515,"open_issues_count":1,"forks_count":86,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-07T16:23:01.703Z","etag":null,"topics":["youtube-dl","yt-dlp"],"latest_commit_sha":null,"homepage":"","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/microlinkhq.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-02-22T20:43:06.000Z","updated_at":"2025-05-07T15:04:12.000Z","dependencies_parsed_at":"2023-02-18T23:10:21.654Z","dependency_job_id":"eef58db2-7572-4da8-9f3d-7afe88386780","html_url":"https://github.com/microlinkhq/youtube-dl-exec","commit_stats":{"total_commits":279,"total_committers":30,"mean_commits":9.3,"dds":"0.18637992831541217","last_synced_commit":"862e3f58a25f52904f962701edcf7fe63638a73b"},"previous_names":[],"tags_count":109,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microlinkhq%2Fyoutube-dl-exec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microlinkhq%2Fyoutube-dl-exec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microlinkhq%2Fyoutube-dl-exec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microlinkhq%2Fyoutube-dl-exec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microlinkhq","download_url":"https://codeload.github.com/microlinkhq/youtube-dl-exec/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254119472,"owners_count":22017951,"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":["youtube-dl","yt-dlp"],"created_at":"2024-07-31T19:01:07.390Z","updated_at":"2026-02-09T12:14:45.091Z","avatar_url":"https://github.com/microlinkhq.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"\u003cpicture\u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://github.com/microlinkhq/cdn/raw/master/dist/logo/banner-dark.png\"\u003e\n  \u003cimg alt=\"microlink cdn\" src=\"https://github.com/microlinkhq/cdn/raw/master/dist/logo/banner.png\" align=\"center\"\u003e\n\u003c/picture\u003e\n\u0026nbsp;\n\n![Last version](https://img.shields.io/github/tag/microlinkhq/youtube-dl-exec.svg?style=flat-square)\n[![Coverage Status](https://img.shields.io/coveralls/microlinkhq/youtube-dl-exec.svg?style=flat-square)](https://coveralls.io/github/microlinkhq/youtube-dl-exec)\n[![NPM Status](https://img.shields.io/npm/dm/youtube-dl-exec.svg?style=flat-square)](https://www.npmjs.org/package/youtube-dl-exec)\n\n\u003e A simple Node.js wrapper for [yt-dlp](https://github.com/yt-dlp/yt-dlp).\n\n## Why\n\n- Auto install the latest `yt-dlp` version available.\n- Executes any command in an efficient way.\n- Promise \u0026 Stream interface support.\n\n## Install\n\n\u003e **Note**: It requires Python 3.7 or above available in your system as `python3`. Otherwise, the library will throw an error.\n\n```bash\n$ npm install youtube-dl-exec --save\n```\n\nBy default, the library will auto-install the latest `yt-dlp` available that will downloaded on [build](https://github.com/microlinkhq/youtube-dl-exec/blob/master/package.json#L70) time.\n\n## Usage\n\nAny `yt-dlp` flags is supported:\n\n```js\nconst youtubedl = require('youtube-dl-exec')\n\nyoutubedl('https://www.youtube.com/watch?v=6xKWiCMKKJg', {\n  dumpSingleJson: true,\n  noCheckCertificates: true,\n  noWarnings: true,\n  preferFreeFormats: true,\n  addHeader: ['referer:youtube.com', 'user-agent:googlebot']\n}).then(output =\u003e console.log(output))\n```\n\nIt's equivalent to:\n\n```bash\n$ ./bin/yt-dlp \\\n  --dump-single-json \\\n  --no-check-certificates \\\n  --no-warnings \\\n  --prefer-free-formats \\\n  --add-header='user-agent:googlebot' \\\n  --add-header='referer:youtube.com' \\\n  'https://www.youtube.com/watch?v=6xKWiCMKKJg'\n```\n\nType `yt-dlp --help` for seeing all of them.\n\n## Custom binary\n\nIn case you need, you can specify your own binary path using [`.create`]():\n\n```js\nconst { create: createYoutubeDl } = require('youtube-dl-exec')\nconst youtubedl = createYoutubeDl('/my/binary/path')\n```\n\n## Progress bar\n\nSince the library is returning a promise, you can use any library that makes a progress estimation taking a promise as input:\n\n```js\nconst logger = require('progress-estimator')()\nconst youtubedl = require('youtube-dl-exec')\n\nconst url = 'https://www.youtube.com/watch?v=6xKWiCMKKJg'\nconst promise = youtubedl(url, { dumpSingleJson: true })\nconst result = await logger(promise, `Obtaining ${url}`)\n\nconsole.log(result)\n```\n\nAlternatively, you can access to the subprocess to have more granular control. See [youtubedl.exec](https://github.com/microlinkhq/youtube-dl-exec#youtubedlexecurl-flags-options).\n\nAlso, combine that with [YOUTUBE_DL_SKIP_DOWNLOAD](#youtube_dl_skip_download). See [environment variables](#environment-variables) to know more.\n\n## Timeout \u0026 cancellation\n\nYou can customize [spawn#options](https://nodejs.org/api/child_process.html#child_processspawncommand-args-options) by passing a third argument:\n\n```js\nconst url = 'https://www.youtube.com/watch?v=6xKWiCMKKJg'\nconst result = await youtubedl.exec(url, ,{ dumpSingleJson: true }, {\n  timeout: 5000,\n  killSignal: 'SIGKILL'\n})\n\nconsole.log(result)\n```\n\nYou can also interact with the subprocess programmatically:\n\n```js\nconst url = 'https://www.youtube.com/watch?v=6xKWiCMKKJg'\nconst subprocess = youtubedl.exec(url, { dumpSingleJson: true })\n\nsetTimeout(() =\u003e {\n  subprocess.kill('SIGKILL')\n}, 5000)\n\nconst result = await subprocess\nconsole.log(result)\n```\n\n## API\n\n### youtubedl(url, [flags], [options])\n\nIt execs any `yt-dlp` command, returning back the output.\n\n#### url\n\n_Required_\u003cbr\u003e\nType: `string`\n\nThe URL to target.\n\n#### flags\n\nType: `object`\n\nAny flag supported by `yt-dlp`.\n\n#### options\n\nAny option provided here will passed to [spawn#options](https://nodejs.org/api/child_process.html#child_processspawncommand-args-options).\n\n### youtubedl.exec(url, [flags], [options])\n\nSimilar to main method but instead of a parsed output, it will return the internal subprocess object:\n\n```js\nconst youtubedl = require('youtube-dl-exec')\nconst fs = require('fs')\n\nconst subprocess = youtubedl.exec(\n  'https://www.youtube.com/watch?v=6xKWiCMKKJg',\n  {\n    dumpSingleJson: true\n  }\n)\n\nconsole.log(`Running subprocess as ${subprocess.pid}`)\n\nsubprocess.stdout.pipe(fs.createWriteStream('stdout.txt'))\nsubprocess.stderr.pipe(fs.createWriteStream('stderr.txt'))\n\nsetTimeout(subprocess.cancel, 30000)\n```\n\n### youtubedl.create(binaryPath)\n\nIt creates a `yt-dlp` using the `binaryPath` provided.\n\n## Environment variables\n\nThe environment variables are used to customize the [postinstall script](https://github.com/microlinkhq/youtube-dl-exec/blob/master/scripts/postinstall.js) behavior that will be triggered after `npm install` is performed.\n\nThis is mostly for backward compatibility or debugging purposes. You don't need to do anything by default.\n\n### DEBUG\n\nSet `DEBUG=\"youtube-dl-exec*\"` to enable debug mode. This will enable log additional information during the post-install script.\n\n### YOUTUBE_DL_DIR\n\nIt determines the folder where to put the binary file.\n\nThe default folder is `bin`.\n\n### YOUTUBE_DL_FILENAME\n\nIt determines the binary filename.\n\nThe default binary file could be `yt-dlp` or `youtube-dl.exe`, depending of the [`YOUTUBE_DL_PLATFORM`](#youtube_dl_platform) value.\n\n### YOUTUBE_DL_HOST\n\nIt determines the remote URL for getting the `yt-dlp` binary file.\n\nThe default URL is [yt-dlp/yt-dlp latest release](https://github.com/yt-dlp/yt-dlp/releases/latest).\n\n### YOUTUBE_DL_PLATFORM\n\nIt determines the architecture of the machine that will use the `yt-dlp` binary.\n\nThe default value will computed from `process.platform`, being `'unix'` or `'win32'`.\n\n### YOUTUBE_DL_SKIP_DOWNLOAD\n\nWhen is present, it will skip the [postinstall](/scripts/postinstall.js) script for fetching the latest `yt-dlp` version.\n\nThat variable should be set before performing the installation command, such as:\n\n```bash\nYOUTUBE_DL_SKIP_DOWNLOAD=true npm install\n```\n\n### YOUTUBE_DL_SKIP_PYTHON_CHECK\n\nWhen is present, it skip the python step on installation.\n\n## License\n\n**youtube-dl-exec** © [microlink.io](https://microlink.io), released under the [MIT](https://github.com/microlinkhq/youtube-dl-exec/blob/master/LICENSE.md) License.\u003cbr\u003e\nAuthored and maintained by [Kiko Beats](https://kikobeats.com) with help from [contributors](https://github.com/microlinkhq/youtube-dl-exec/contributors).\n\n\u003e [microlink.io](https://microlink.io) · GitHub [microlink.io](https://github.com/microlinkhq) · X [@microlinkhq](https://x.com/microlinkhq)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrolinkhq%2Fyoutube-dl-exec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrolinkhq%2Fyoutube-dl-exec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrolinkhq%2Fyoutube-dl-exec/lists"}