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

ytdl-lite

v1.0.0

Published

YouTube downloader — MP3 & MP4 with quality selection, JSON info, and file path output

Downloads

114

Readme

✨ ytdl-lite

🚀 Fast & reliable YouTube downloader — MP3 & MP4 with quality selection, metadata, and smart file paths. ⚡ Powered by dual scrapers with automatic fallback for maximum uptime.


📦 Install

npm install ytdl-lite

⚡ Features

  • 🎵 Download MP3 (best / 320 / 256 / 128 kbps)
  • 🎬 Download MP4 (1080p / 720p / 480p / 360p)
  • 🔄 Auto fallback system (2 scrapers)
  • 📊 Full video metadata (JSON)
  • 📁 Clean auto-generated file paths
  • 🧠 Smart format detection
  • 💻 CLI support

🚀 Quick Start

const ytdl = require('ytdl-lite');

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

// 🎵 MP3
const mp3 = await ytdl.ytmp3(URL);
console.log(mp3.url);
console.log(mp3.path);

// 🎬 MP4 (best)
const mp4 = await ytdl.ytmp4(URL);
console.log(mp4.url);
console.log(mp4.path);

// 🎬 MP4 (specific quality)
const hd = await ytdl.ytmp4(URL, '1080');
console.log(hd.quality, hd.url);

// 📦 All formats
const all = await ytdl.ytmp4(URL, null);
all.medias.forEach(m => console.log(m.type, m.label));

// 📊 Info only
const info = await ytdl.getInfo(URL);
console.log(info.title, info.duration);

📚 API Reference

🎵 ytmp3(url, quality = 'best', opts = {})

Download audio in MP3 format.

| Param | Type | Description | | ---------- | -------- | -------------------------------- | | url | string | YouTube URL | | quality | string | best, 320, 256, 128 | | opts.dir | string | Output directory (default: ./) |

Response

{
  "status": true,
  "title": "Never Gonna Give You Up",
  "url": "...",
  "quality": "best",
  "type": "audio",
  "path": "./never-gonna-give-you-up.mp3"
}

🎬 ytmp4(url, quality = 'best', opts = {})

Download video in MP4 format.

| Param | Type | Description | | ---------- | ---------------- | ---------------------------------------------- | | url | string | YouTube URL | | quality | string \| null | best, 1080, 720, 480, 360, or null | | opts.dir | string | Output directory |


▶ Single format

{
  "status": true,
  "title": "...",
  "quality": "1080",
  "type": "video",
  "url": "...",
  "path": "./video.mp4"
}

📦 All formats (quality = null)

{
  "status": true,
  "title": "...",
  "medias": [
    { "type": "video", "quality": "1080", "label": "1080p" },
    { "type": "audio", "quality": "128", "label": "MP3 • 128kbps" }
  ]
}

📊 getInfo(url)

Get full metadata + all available formats.


🖥️ CLI Usage

npm install -g ytdl-lite
# MP3
ytdl mp3 https://youtu.be/VIDEO_ID

# MP4
ytdl mp4 https://youtu.be/VIDEO_ID 1080

# Info
ytdl info https://youtu.be/VIDEO_ID

📁 Project Structure

ytdl-lite/
├── index.js
├── lib/
│   ├── ytmp3.js
│   ├── ytmp4.js
│   ├── info.js
│   ├── savetube.js
│   ├── ytdlnew.js
│   └── utils.js
├── bin/cli.js
├── test.js
└── package.json

🛡️ Reliability

This package uses two independent scraping engines. If one fails, the other automatically takes over — ensuring high success rates.


📜 License

MIT © DanuZz


💡 Pro Tip

Use quality = null to build your own custom downloader UI with all formats.