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

bebytdl

v1.0.0

Published

A comprehensive YouTube video and audio downloader with multiple fallback methods

Readme

BebyTDL - YouTube Downloader

A comprehensive Node.js package for downloading YouTube videos and audio with multiple fallback methods.

Features

  • ✅ Download YouTube videos in multiple qualities
  • ✅ Download YouTube audio/music
  • ✅ Support for YouTube Shorts
  • ✅ Multiple API endpoints for reliability
  • ✅ Auto-fallback mechanism
  • ✅ Simple and easy-to-use API

Installation

npm install bebytdl

Quick Start

const { autoDownload, downloadVideo, downloadAudio } = require('bebytdl');

// Auto-detect and download (recommended)
const result = await autoDownload('https://youtu.be/VIDEO_ID');

if (result.success) {
  console.log('Title:', result.data.title);
  console.log('Download links:', result.data.downloadLinks);
}

API Reference

autoDownload(url)

Automatically detects the best download method and provides fallback options.

Parameters:

  • url (string): YouTube video URL

Returns: Promise<Object>

const result = await autoDownload('https://youtu.be/3sDfsZboq3Y');
// Returns: { success: boolean, data: {...}, source: string }

downloadVideo(url)

Downloads video using the Vidfly API (supports multiple qualities).

Parameters:

  • url (string): YouTube video URL

Returns: Promise<Object>

const result = await downloadVideo('https://youtu.be/3sDfsZboq3Y');
// Returns: { success: boolean, data: { title, cover, duration, downloadLinks }, source: 'vidfly' }

downloadAudio(url)

Downloads audio using the Clipto API.

Parameters:

  • url (string): YouTube video URL

Returns: Promise<Object>

const result = await downloadAudio('https://youtu.be/3sDfsZboq3Y');
// Returns: { success: boolean, data: {...}, source: 'clipto' }

Response Format

Successful Response

{
  success: true,
  data: {
    title: "Video Title",
    cover: "thumbnail_url",
    duration: "120 seconds",
    downloadLinks: [
      {
        id: 1,
        quality: "720p",
        format: "mp4",
        size: "25.4MB",
        url: "download_url",
        type: "video/mp4"
      }
    ]
  },
  source: "vidfly" // or "clipto"
}

Error Response

{
  success: false,
  error: "Error message",
  source: "vidfly" // or "clipto"
}

Usage Examples

Basic Video Download

const bebytdl = require('bebytdl');

async function downloadYouTubeVideo() {
  try {
    const url = 'https://youtu.be/dQw4w9WgXcQ';
    const result = await bebytdl.autoDownload(url);
    
    if (result.success) {
      console.log('✅ Download successful!');
      console.log('Title:', result.data.title);
      console.log('Available formats:');
      
      result.data.downloadLinks.forEach(link => {
        console.log(`- ${link.quality} (${link.format}) - ${link.size}`);
        console.log(`  Download: ${link.url}`);
      });
    } else {
      console.error('❌ Download failed:', result.error);
    }
  } catch (error) {
    console.error('Error:', error.message);
  }
}

downloadYouTubeVideo();

Audio-Only Download

const bebytdl = require('bebytdl');

async function downloadAudio() {
  const url = 'https://youtu.be/dQw4w9WgXcQ';
  const result = await bebytdl.downloadAudio(url);
  
  if (result.success) {
    console.log('Audio download data:', result.data);
  }
}

Multiple URLs

const bebytdl = require('bebytdl');

const urls = [
  'https://youtu.be/dQw4w9WgXcQ',
  'https://youtu.be/3sDfsZboq3Y'
];

async function downloadMultiple() {
  for (const url of urls) {
    console.log(`\nProcessing: ${url}`);
    const result = await bebytdl.autoDownload(url);
    
    if (result.success) {
      console.log(`✅ ${result.data.title}`);
    } else {
      console.log(`❌ Failed: ${result.error}`);
    }
  }
}

downloadMultiple();

Supported URLs

  • Regular YouTube videos: https://www.youtube.com/watch?v=VIDEO_ID
  • YouTube Shorts: https://www.youtube.com/shorts/VIDEO_ID
  • Short URLs: https://youtu.be/VIDEO_ID
  • URLs with parameters: https://youtu.be/VIDEO_ID?si=SHARE_ID

Error Handling

The package includes comprehensive error handling:

const result = await bebytdl.autoDownload(url);

if (!result.success) {
  switch (result.source) {
    case 'vidfly':
      console.log('Video download failed:', result.error);
      break;
    case 'clipto':
      console.log('Audio download failed:', result.error);
      break;
    default:
      console.log('Both methods failed');
      console.log('Video error:', result.videoError);
      console.log('Audio error:', result.audioError);
  }
}

Dependencies

  • axios: HTTP client for API requests

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the ISC License - see the package.json file for details.

Disclaimer

This package is for educational purposes only. Make sure you comply with YouTube's Terms of Service and respect content creators' rights. The authors are not responsible for any misuse of this package.

Support

If you encounter any issues or have questions, please open an issue on the GitHub repository.


Made with ❤️ for the developer community