@alpacamybags118/yt-dlp-exec
v0.1.1
Published
Wrapper around yp-dlp to execute it as a process in your project.
Downloads
70
Readme
yt-dlp-exec
A small wrapper around yt-dlp, which allows you to invoke it as a child process in your node project. Inspired by youtube-dl-exec. Made for personal use/learning, but anyone is welcome to use/extend it.
Features
- Downloads appropriate
yt-dlp
for OS (seedownload-yt-dlp.js
) - Allows you to pass any supported
yt-dlp
arguments
Requirements
- Node version 12 or greater
Install
npm install @alpacamybags118/yt-dlp-exec
Usage
Javascript
const yt = require('@alpacamybags118/yt-dlp-exec');
const result = yt.createYtDlpAsProcess('https://some.url', {
f: 'bestaudio',
preferFreeFormats: true,
});
result.on('exit', (exit) => {
console.log(exit);
})
Typescript
import createYtDlpAsProcess from '@alpacamybags118/yt-dlp-exec'
const process = createYtDlpAsProcess(
'https://some.url',
{
o: '-',
q: '',
f: 'bestaudio',
preferFreeFormats: true,
r: '100K',
}
);
You can also pass custom process options (in execa
format: see https://github.com/sindresorhus/execa) for more control over settings such as stdio.
const yt = require('@alpacamybags118/yt-dlp-exec');
const result = yt.createYtDlpAsProcess('https://some.url', {
f: 'bestaudio',
preferFreeFormats: true,
}, { stdio: ['pipe', 'pipe', 'pipe'] });
result.on('exit', (exit) => {
console.log(exit);
})
Argument list fo commands uses dargs
formatting. Returned child process is in execa
format