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

@saumondeluxe/musicord-dl

v1.2.0

Published

A simple node package for discord music bot developers to download YouTube videos as MP3

Readme

@saumondeluxe/musicord-dl

A simple Node.js package for Discord music bot developers to download YouTube videos as MP3 files.

Features

  • Download YouTube videos as high-quality MP3 files
  • Automatic virtual environment setup
  • Built on top of yt-dlp for reliable downloading
  • ES modules support
  • Easy integration with Discord bots

Prerequisites

  • Node.js 16.0.0 or higher
  • Python 3.7 or higher
  • FFmpeg (automatically installed if not present)

Installation

npm install @saumondeluxe/musicord-dl

Usage

ES Modules (import/export)

import run from '@saumondeluxe/musicord-dl';

// Download a YouTube video as MP3
const filePath = await run('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
console.log('Downloaded file:', filePath);

CommonJS (require/module.exports)

const run = require('@saumondeluxe/musicord-dl');

// Download a YouTube video as MP3
(async () => {
    const filePath = await run('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
    console.log('Downloaded file:', filePath);
})();

Basic Usage

Both syntaxes work exactly the same way!

Example with Discord Bot (ES Modules)

import { Client, GatewayIntentBits } from 'discord.js';
import run from '@saumondeluxe/musicord-dl';

const client = new Client({
    intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent]
});

client.on('messageCreate', async (message) => {
    if (message.content.startsWith('!download ')) {
        const url = message.content.split(' ')[1];
        
        if (url && url.includes('youtube.com')) {
            message.reply('Downloading...');
            try {
                const filePath = await run(url);
                message.reply({
                    content: 'Download completed! 🎵',
                    files: [filePath]
                });
            } catch (error) {
                message.reply('Error downloading the video.');
            }
        }
    }
});

client.login('YOUR_BOT_TOKEN');

Example with Discord Bot (CommonJS)

const { Client, GatewayIntentBits } = require('discord.js');
const run = require('@saumondeluxe/musicord-dl');

const client = new Client({
    intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent]
});

client.on('messageCreate', async (message) => {
    if (message.content.startsWith('!download ')) {
        const url = message.content.split(' ')[1];
        
        if (url && url.includes('youtube.com')) {
            message.reply('Downloading...');
            try {
                const filePath = await run(url);
                message.reply({
                    content: 'Download completed! 🎵',
                    files: [filePath]
                });
            } catch (error) {
                message.reply('Error downloading the video.');
            }
        }
    }
});

client.login('YOUR_BOT_TOKEN');

API

run(url)

Downloads a YouTube video as an MP3 file and returns the file path.

Parameters:

  • url (string): The YouTube video URL to download

Returns:

  • Promise: The absolute path to the downloaded MP3 file

Example:

// ES Modules
import run from '@saumondeluxe/musicord-dl';
const filePath = await run('https://www.youtube.com/watch?v=VIDEO_ID');
console.log('Downloaded to:', filePath);

// CommonJS
const run = require('@saumondeluxe/musicord-dl');
const filePath = await run('https://www.youtube.com/watch?v=VIDEO_ID');
console.log('Downloaded to:', filePath);

// File will be saved with the video title as filename
// Example: "Never_Gonna_Give_You_Up_dQw4w9WgXcQ.mp3"

Output

The downloaded MP3 file will be saved with a unique filename based on the video title and ID in the current working directory. The function returns the absolute path to the downloaded file.

Filename format: {VideoTitle}_{VideoID}.mp3

Example: Never_Gonna_Give_You_Up_dQw4w9WgXcQ.mp3

Dependencies

This package automatically manages its Python dependencies:

  • yt-dlp: For downloading YouTube videos
  • Python virtual environment for isolation

Requirements

  • Python 3.7+
  • FFmpeg (for audio conversion)

License

ISC

Author

SaumonDeLuxe [email protected]

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Changelog

1.2.0

  • Breaking Change: run() function now returns the file path instead of void
  • Automatic filename generation based on video title and ID
  • Improved file naming with special character handling
  • Enhanced error handling and fallback naming

1.1.0

  • Added CommonJS support (require/module.exports)
  • Package now supports both ES Modules and CommonJS
  • Updated documentation with examples for both syntaxes

1.0.1

  • Fixed GitHub repository URLs in package.json for musicord-dl

1.0.0

  • Initial release
  • YouTube to MP3 download functionality
  • Automatic virtual environment setup
  • ES modules support