npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

yt-dlp-wrapper

v1.2.2

Published

A simple wrapper for the yt-dlp command line utility.

Downloads

17

Readme

YT-DLP Wrapper

A small wrapper for usage of the yt-dlp command-line utility project with JavaScript/TypeScript.

NOTE: This package is still in development and may not work as expected. Additional features such as download options will be added in the very near future.

Features

  • Download videos (single or playlist)
  • Progress events for downloads
  • Concurrent downloads with a configurable limit
  • Video metadata (single or playlist)
  • Video count for playlists

Installation

npm install --save yt-dlp-wrapper

Getting Started

The package can be imported with both CommonJS and ES6.

// ES6
import { DownloadCommand, MetadataCommand, VideoCountCommand } from 'yt-dlp-wrapper';

// CommonJS
const { DownloadCommand, MetadataCommand, VideoCountCommand } = require('yt-dlp-wrapper');

Usage

Download

import { DownloadCommand, DownloadProgress } from 'yt-dlp-wrapper';

// The absolute path to the store the downloaded files
const command = new DownloadCommand('C:\\Users\\User\\Downloads', {});

// Get the current download progress
command.on('progress', (progress: DownloadProgress): void => {
  console.log(progress);
});

// Get the download error if one occurs
command.on('error', (error: Error): void => {
  console.error(error);
});

// Get the download completion event
command.on('complete', (): void => {
  console.log('Download finished!');
});

// Add URL to download
command.add('https://www.youtube.com/watch?v=dQw4w9WgXcQ');

// Start the download
command.start();

Metadata

import { MetadataCommand, VideoDetails } from 'yt-dlp-wrapper';

const command = new MetadataCommand({});

// Get the execution error if one occurs
command.on('error', (error: Error): void => {
  console.error(error);
});

// Get the metadata extraction completion event
command.on('complete', (metadata: VideoDetails[]): void => {
  console.log('Metadata extracted!');
});

// Start the metadata extraction
command.get('https://www.youtube.com/watch?v=dQw4w9WgXcQ');

or

import { MetadataCommand, VideoDetails } from 'yt-dlp-wrapper';

const command = new MetadataCommand({});

try {
  // Perform the metadata extraction
  const metadata: VideoDetails[] = await command.getSync('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
} catch (err) {
  // Handle the error
}

Video Count

import { VideoCountCommand } from 'yt-dlp-wrapper';

const command = new VideoCountCommand({});

// Get the execution error if one occurs
command.on('error', (error: Error): void => {
  console.error(error);
});

// Get the video count completion event
command.on('complete', (count: number): void => {
  console.log('Video count retrieved!');
});

// Start the video count extraction
command.get('https://www.youtube.com/watch?v=dQw4w9WgXcQ');

or

import { VideoCountCommand } from 'yt-dlp-wrapper';

const command = new VideoCountCommand({});

try {
  // Perform the video count extraction
  const count = await command.getSync('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
} catch (err) {
  // Handle the error
}

Warning

  • This package/software is not affiliated with the yt-dlp project.
  • This package/software is intended for personal use only.
  • Breaking DRM protection would imply piracy, so any functionality to do so will not be included.
  • Use of this package/software is at your own risk. Some third-party video platforms prohibit the downloading of their content. I am NOT responsible if your account gets banned/suspended.

License

This project is licensed under the MIT License - see the LICENSE file for details.