
Company News
/Security News
Socket Selected for OpenAI's Cybersecurity Grant Program
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.
yt-dlp-wrap-extended
Advanced tools
This is a fork of yt-dlp wrap with some modifications (Added support to download full binary for linux and fixed problems with progress).
Modification: To download full binary fo linux -
await YTDlpWrap.downloadFromGithub(
"path/to/yt-dlp/binary",
"",
"linux",
true
);
A simple node.js wrapper for yt-dlp.
You can install yt-dlp-wrap via npm (npm i yt-dlp-wrap).
YT-dlp itself will not be automatically downloaded.
Provide it yourself or use some of the following functions to download the binary.
Typescript (only import differs)
import YTDlpWrap from 'yt-dlp-wrap';
Javascript
const YTDlpWrap = require('yt-dlp-wrap').default;
//Get the data from the github releases API. In this case get page 1 with a maximum of 5 items.
let githubReleasesData = await YTDlpWrap.getGithubReleases(1, 5);
//Download the yt-dlp binary for the given version and platform to the provided path.
//By default the latest version will be downloaded to "./yt-dlp" and platform = os.platform().
await YTDlpWrap.downloadFromGithub(
'path/to/yt-dlp/binary',
'2020.06.16.1',
'win32'
);
//Init an instance with a given binary path.
//If none is provided "yt-dlp" will be used as command.
const ytDlpWrap = new YTDlpWrap('path/to/yt-dlp/binary');
//The binary path can also be changed later on.
ytDlpWrap.setBinaryPath('path/to/another/yt-dlp/binary');
Excecute yt-dlp and returns an EventEmitter.
The ytDlpEvent event will expose all yt-dlp events, for example:
The log message [download] Destination: output.mp4 will emit the event type download and the event data Destination: output.mp4.
ytDlpEmitter.ytDlpProcess exposes the spawned yt-dlp process.
const YTDlpWrap = require('yt-dlp-wrap').default;
const ytDlpWrap = new YTDlpWrap('path/to/yt-dlp/binary');
let ytDlpEventEmitter = ytDlpWrap
.exec([
'https://www.youtube.com/watch?v=aqz-KE-bpKQ',
'-f',
'best',
'-o',
'output.mp4',
])
.on('progress', (progress) =>
console.log(
progress.percent,
progress.totalSize,
progress.currentSpeed,
progress.eta
)
)
.on('ytDlpEvent', (eventType, eventData) =>
console.log(eventType, eventData)
)
.on('error', (error) => console.error(error))
.on('close', () => console.log('all done'));
console.log(ytDlpEventEmitter.ytDlpProcess.pid);
Excecute yt-dlp and returns an Readable Stream.
The interface works just like the EventEmitter.
let readableStream = ytDlpWrap.execStream([
'https://www.youtube.com/watch?v=aqz-KE-bpKQ',
'-f',
'best[ext=mp4]',
]);
readableStream.pipe(fs.createWriteStream('test.mp4'));
Excecute yt-dlp and returns an Promise.
let stdout = await ytDlpWrap.execPromise([
'https://www.youtube.com/watch?v=aqz-KE-bpKQ',
'-f',
'best',
'-o',
'output.mp4',
]);
console.log(stdout);
Additionally you can set the options of the spawned process and abort the process.
The abortion of the spawned process is handled by passing the signal of an AbortController.
let controller = new AbortController();
let ytDlpEventEmitter = ytDlpWrap.exec(
[
'https://www.youtube.com/watch?v=aqz-KE-bpKQ',
'-f',
'best',
'-o',
'output.mp4',
],
{ shell: true, detached: true },
controller.signal
);
setTimeout(() => {
controller.abort();
console.log(ytDlpEventEmitter.ytDlpProcess.killed);
}, 500);
Returns the yt-dlp --dump-json metadata as an object.
let metadata = await ytDlpWrap.getVideoInfo(
'https://www.youtube.com/watch?v=aqz-KE-bpKQ'
);
console.log(metadata.title);
Just a few utility functions to get informations.
let version = await ytDlpWrap.getVersion();
let userAgent = await ytDlpWrap.getUserAgent();
let help = await ytDlpWrap.getHelp();
let extractors = await ytDlpWrap.getExtractors();
let extractorDescriptions = await ytDlpWrap.getExtractorDescriptions();
MIT
FAQs
A simple node.js wrapper for yt-dlp.
The npm package yt-dlp-wrap-extended receives a total of 13 weekly downloads. As such, yt-dlp-wrap-extended popularity was classified as not popular.
We found that yt-dlp-wrap-extended demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.