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

ytb2mp3

v0.2.10

Published

Convert YouTube videos to mp3 files via the command-line

Downloads

64

Readme

ytb2mp3

A command-line client for extracting mp3s from YouTube videos

Installation

Prerequisites

You need a working installation of ffmpeg on your system. If you're on a Mac, you can use HomeBrew to install it like this:

$ brew install ffmpeg

npm

ytb2mp3 can be installed via npm:

$ npm install ytb2mp3 -g

Configuration

Configuration options

ytb2mp3 can be configured by passing command-line flags. The following flags are available:

--set-output-path <path>                The absolute path where the downloaded files should be stored (default: /tmp)
                                        The directory is automatically created if it doesn't exist
--set-video-quality <quality>           The quality of the YouTube videos that should be requested (default: highesst)
--set-ffmpeg-path <path>                The absolute path to the ffmpeg binary (default: /usr/local/bin/ffmpeg)
--set-progress-timeout <milliseconds>   The time in milliseconds in which the download progress should be refreshed
                                        (default: 200ms)

This information is also displayed when ytb2mp3 is called with the --help flag.

The configuration options will be persisted in ~/.config/configstore/ytb2mp3.json.

Usage

Download a video's audio as mp3

$ ytb2mp3 https://www.youtube.com/watch?v=Vhd6Kc4TZls

This will yield in the following output:

Downloading [██████████████████████████░░░░░░░░░░░░░░] 65% | ETA: 3s | Runtime: 4s | Speed: 1518.28 kbytes/sec

After the finished download, it will point to the output file:

Song was downloaded: /Users/username/yt2mp3/Cold Funk - Funkorama.mp3

Specifying a filename

You can use the --name "filename.extension" flag to specify a name for the output file:

$ ytb2mp3 --name "Cold Funk - Funkorama.mp3" https://www.youtube.com/watch?v=Vhd6Kc4TZls

This is useful if the algorithm of youtube-mp3-downloader cannot automatically determine a decent filename from the video's metadata.

Pasting a copied URL from the clipboard (MacOS)

Copy a video URL from your browser. Then, you can use the command

$ pbpaste | ytb2mp3

to directly download the video's audio.