{"id":13908772,"url":"https://github.com/JamesKyburz/youtube-audio-stream","last_synced_at":"2025-07-18T08:31:34.533Z","repository":{"id":10064545,"uuid":"12117036","full_name":"JamesKyburz/youtube-audio-stream","owner":"JamesKyburz","description":"youtube audio stream","archived":false,"fork":false,"pushed_at":"2025-04-26T15:42:14.000Z","size":211,"stargazers_count":351,"open_issues_count":10,"forks_count":65,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-06-24T14:11:25.645Z","etag":null,"topics":["audio","ffmpeg","javascript","nodejs","streams-youtube","youtube"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JamesKyburz.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2013-08-14T19:04:14.000Z","updated_at":"2025-04-26T15:42:17.000Z","dependencies_parsed_at":"2024-04-16T04:46:16.119Z","dependency_job_id":"5e3afc1d-b74b-4c69-aa05-0e361eb677a3","html_url":"https://github.com/JamesKyburz/youtube-audio-stream","commit_stats":{"total_commits":322,"total_committers":16,"mean_commits":20.125,"dds":0.6459627329192547,"last_synced_commit":"ca03f77de6d5b64d77949ac977089cfab5162a02"},"previous_names":[],"tags_count":108,"template":false,"template_full_name":null,"purl":"pkg:github/JamesKyburz/youtube-audio-stream","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesKyburz%2Fyoutube-audio-stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesKyburz%2Fyoutube-audio-stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesKyburz%2Fyoutube-audio-stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesKyburz%2Fyoutube-audio-stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JamesKyburz","download_url":"https://codeload.github.com/JamesKyburz/youtube-audio-stream/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesKyburz%2Fyoutube-audio-stream/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265728814,"owners_count":23818729,"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":["audio","ffmpeg","javascript","nodejs","streams-youtube","youtube"],"created_at":"2024-08-06T23:02:58.757Z","updated_at":"2025-07-18T08:31:34.252Z","avatar_url":"https://github.com/JamesKyburz.png","language":"JavaScript","funding_links":[],"categories":["HarmonyOS"],"sub_categories":["Windows Manager"],"readme":"# youtube-audio-stream\n\n[![js-standard-style](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/feross/standard)\n[![ci](https://github.com/JamesKyburz/youtube-audio-stream/actions/workflows/ci.yml/badge.svg)](https://github.com/JamesKyburz/youtube-audio-stream/actions/workflows/ci.yml)\n\nThis module streams youtube using [ytdl](https://github.com/fent/node-ytdl) to get the youtube download stream.\n\nTo convert to audio the module [fluent-ffmpeg](https://github.com/schaermu/node-fluent-ffmpeg) is used.\n\nYou will need to have [ffmpeg](http://www.ffmpeg.org/) and the necessary encoding libraries installed, as well as in your PATH.\n\nIf you're on OSX, this can be handled easily using [Homebrew](http://brew.sh/) with `brew install ffmpeg`.\n\n## Getting Started\n\n1. With [npm](http://npmjs.org), run `npm install youtube-audio-stream`\n2. `const stream = require('youtube-audio-stream')`\n\n## Usage\n\nHere is an example that:\n\n1. queries for a video by video ID\n2. Retrieves the audio via this package\n3. write it to `res`\n\n```js\nconst stream = require('youtube-audio-stream')\nasync function handleView (req, res) {\n  try {\n    for await (const chunk of stream(`http://youtube.com/watch?v=${req.params.videoId}`)) {\n      res.write(chunk)\n    }\n    res.end()\n  } catch (err) {\n    console.error(err)\n    if (!res.headersSent) {\n      res.writeHead(500)\n      res.end('internal system error')\n    }\n  }\n}\n```\n\n## Node example playing directly to speaker\n```js\nconst stream = require('youtube-audio-stream')\nconst url = 'http://youtube.com/watch?v=34aQNMvGEZQ'\nconst decoder = require('lame').Decoder\nconst speaker = require('speaker')\n\nstream(url)\n.pipe(decoder())\n.pipe(speaker())\n```\n\n## Testing\n\nThis package comes with a simple example for testing. This can be run with the command `npm test`, which will then serve the example at `localhost:3000`. The example consists of an `\u003caudio\u003e` component whose source is retrieved via this package.\n\n### Testing inside a docker container\n\nYou can test this module without the need o have [ffmeg](http://www.ffmpeg.org/) locally installed\ndoing it inside a container.\n\nTo build the Docker image:\n```\ndocker build . -t youtube-audio-stream-test\n```\n\nTo run the test:\n```\ndocker run --rm -it -p 3000:3000 youtube-audio-stream-test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJamesKyburz%2Fyoutube-audio-stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJamesKyburz%2Fyoutube-audio-stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJamesKyburz%2Fyoutube-audio-stream/lists"}