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 🙏

© 2026 – Pkg Stats / Ryan Hefner

uzair-mtx-sir-ytdl

v1.1.1

Published

A wrapper package for ytdl-core to simplify YouTube video and audio downloading.

Readme

uzairsirmtx-ytdl-core

uzairsirmtx-ytdl-core is a simplified wrapper around the popular ytdl-core library, designed to make YouTube video and audio downloading easier to integrate into your Node.js applications. It provides a clean, class-based interface for common ytdl-core functionalities.

Features

  • Simplified API: Easy-to-use methods for common ytdl-core tasks.
  • Video Information: Retrieve detailed information about YouTube videos.
  • Video & Audio Downloading: Stream YouTube videos or extract only audio.
  • URL Validation: Helper function to validate YouTube URLs.

Installation

To install the package, use npm:

npm install uzairsirmtx-ytdl-core

Required Dependencies:

  • ytdl-core (v4.x or higher)

Usage

Here's how to use UzairsirmtxYTDL in your Node.js application:

const UzairsirmtxYTDL = require('uzairsirmtx-ytdl-core');
const fs = require('fs');

const ytdlClient = new uzairsirmtx();

const videoUrl = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'; // Example YouTube URL

async function exampleUsage() {
    try {
        // Get video information
        const info = await ytdlClient.getVideoInfo(videoUrl);
        console.log('Video Title:', info.videoDetails.title);
        console.log('Video Author:', info.videoDetails.author.name);

        // Download video (example: to a file)
        console.log('Downloading video...');
        ytdlClient.downloadVideo(videoUrl)
            .pipe(fs.createWriteStream('video.mp4'))
            .on('finish', () => console.log('Video downloaded!'))
            .on('error', err => console.error('Video download error:', err.message));

        // Download audio (example: to a file)
        console.log('Downloading audio...');
        ytdlClient.downloadAudio(videoUrl)
            .pipe(fs.createWriteStream('audio.mp3'))
            .on('finish', () => console.log('Audio downloaded!'))
            .on('error', err => console.error('Audio download error:', err.message));

        // Validate URL
        console.log('Is valid URL?', ytdlClient.isValidUrl(videoUrl));
        console.log('Is invalid URL?', ytdlClient.isValidUrl('https://not-a-youtube-url.com'));

        // Get video ID
        console.log('Video ID:', ytdlClient.getVideoID(videoUrl));

    } catch (error) {
        console.error('An error occurred:', error.message);
    }
}

exampleUsage();

UzairsirmtxYTDL Class

constructor()

Initializes the UzairsirmtxYTDL wrapper.

getVideoInfo(url)

Gets detailed information about a YouTube video.

  • url (string): The URL of the YouTube video.
  • Returns: Promise<Object> - A promise that resolves with video information (see ytdl-core documentation for structure).
  • Throws: Error if the URL is invalid or an error occurs during fetching.

downloadVideo(url, options)

Downloads a YouTube video stream.

  • url (string): The URL of the YouTube video.
  • options (Object, optional): Options to pass directly to ytdl-core (e.g., quality, filter).
  • Returns: ReadableStream - A readable stream of the video content.
  • Throws: Error if the URL is invalid or an error occurs during streaming.

downloadAudio(url, options)

Downloads a YouTube audio stream (audio-only).

  • url (string): The URL of the YouTube video.
  • options (Object, optional): Options to pass directly to ytdl-core.
  • Returns: ReadableStream - A readable stream of the audio content.
  • Throws: Error if the URL is invalid or an error occurs during streaming.

isValidUrl(url)

Checks if a given string is a valid YouTube video URL.

  • url (string): The string to validate.
  • Returns: boolean - true if the URL is a valid YouTube video URL, false otherwise.

getVideoID(url)

Extracts the video ID from a YouTube URL.

  • url (string): The URL of the YouTube video.
  • Returns: string|null - The video ID if valid, otherwise null.

Important Notes

  • ytdl-core might require ffmpeg for certain functionalities (e.g., combining audio and video streams if you download them separately). Ensure you have it installed if needed for your specific use case.
  • Always ensure you are complying with YouTube's terms of service when using this package.

License

This project is licensed under the ISC License.