All Projects → ytb2mp3 → Youtube Mp3 Downloader

ytb2mp3 / Youtube Mp3 Downloader

Licence: mit
Extract music from YouTube videos

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Youtube Mp3 Downloader

URTube
URTube, a YouTube video to MP3 downloader built in NodeJs and Electron
Stars: ✭ 20 (-89.3%)
Mutual labels:  downloader, mp3, youtube-dl, youtube-downloader
Youtub.ly Android
An android app to download 📹 videos and songs from youtube to phone internal storage
Stars: ✭ 17 (-90.91%)
Mutual labels:  music, youtube-dl, youtube-downloader, youtube
Candy
🍭 Cross-platform YouTube-downloader with playlist and channel support as well as build-in audio / video converter.
Stars: ✭ 229 (+22.46%)
Mutual labels:  downloader, youtube-dl, youtube-downloader, youtube
Av Converter
[av-converter.com] Audio and Video Converter, and YouTube downloader. Convert to MP3, MP4, AAC, FLAC, AC3, WAV, etc.
Stars: ✭ 97 (-48.13%)
Mutual labels:  music, mp3, downloader, youtube
Youtube Music
YouTube Music Desktop App bundled with custom plugins (and built-in ad blocker / downloader)
Stars: ✭ 376 (+101.07%)
Mutual labels:  music, youtube-dl, youtube-downloader, youtube
Spotiflyer
Spotify/Gaana/Youtube Music Downloader For Android!
Stars: ✭ 231 (+23.53%)
Mutual labels:  music, mp3, youtube-downloader, youtube
Musicdownloader
Material design YouTube mp3/mp4 downloader
Stars: ✭ 70 (-62.57%)
Mutual labels:  music, mp3, downloader, youtube
Getsong
Download any song mp3 with no dependencies except ffmpeg
Stars: ✭ 102 (-45.45%)
Mutual labels:  music, mp3, downloader, youtube
Smd
Spotify Music Downloader
Stars: ✭ 822 (+339.57%)
Mutual labels:  music, youtube-dl, youtube-downloader, youtube
Ytmdl
A simple app to get songs from YouTube in mp3 format with artist name, album name etc from sources like iTunes, Spotify, LastFM, Deezer, Gaana etc.
Stars: ✭ 2,070 (+1006.95%)
Mutual labels:  music, mp3, youtube-dl, youtube
Ytspotifydl
Youtube and Spotify music downloader with metadata.
Stars: ✭ 34 (-81.82%)
Mutual labels:  music, downloader, youtube
Youtube Fetcher
📺 Youtube Podcasting 🎧
Stars: ✭ 31 (-83.42%)
Mutual labels:  mp3, youtube-dl, youtube
Youtube Dl Gui
A cross platform front-end GUI of the popular youtube-dl written in wxPython.
Stars: ✭ 7,914 (+4132.09%)
Mutual labels:  downloader, youtube-dl, youtube
Alltomp3 App
Download and Convert YouTube, SoundCloud & Spotify in MP3 with full tags (title, artist, genre, cover, lyrics 🔥)
Stars: ✭ 920 (+391.98%)
Mutual labels:  music, mp3, youtube
Youtubevideodownloader
Download videos from YouTube and many other video sites
Stars: ✭ 39 (-79.14%)
Mutual labels:  downloader, youtube-dl, youtube-downloader
Firedm
python open source (Internet Download Manager) with multi-connections, high speed engine, based on python, LibCurl, and youtube_dl https://github.com/firedm/FireDM
Stars: ✭ 977 (+422.46%)
Mutual labels:  youtube-dl, youtube-downloader, youtube
Spotivy
🎼 Download music videos from Spotify playlists
Stars: ✭ 64 (-65.78%)
Mutual labels:  mp3, downloader, youtube
Fast Youtube To Mp3 Converter Api
Very Fast YouTube to MP3 & MP4 Converter API
Stars: ✭ 69 (-63.1%)
Mutual labels:  mp3, youtube-dl, youtube-downloader
Hitomi Downloader
🍰 Desktop application to download images/videos/music/text from Hitomi.la and other sites, and more.
Stars: ✭ 1,154 (+517.11%)
Mutual labels:  downloader, youtube-dl, youtube
Album Splitter
Split a single-file mp3 album into its tracks. Supports downloading from YouTube.
Stars: ✭ 160 (-14.44%)
Mutual labels:  music, youtube-dl, youtube

Youtube MP3 Downloader

Youtube MP3 Downloader is a module which allows to specify YouTube videos from which the audio data should be extracted, converted to MP3, and stored on disk.

Installation

Prerequisites

To run this project, you need to have a local installation of FFmpeg present on your system. You can download it from https://www.ffmpeg.org/download.html

Installation via NPM

npm install youtube-mp3-downloader --save

Installation from Github

Checkout the project from Github to a local folder

git clone https://github.com/ytb2mp3/youtube-mp3-downloader.git

Install module dependencies

Navigate to the folder where you checked out the project to in your console. Run npm install.

Running

Basic example

A basic usage example is the following:

var YoutubeMp3Downloader = require("youtube-mp3-downloader");

//Configure YoutubeMp3Downloader with your settings
var YD = new YoutubeMp3Downloader({
    "ffmpegPath": "/path/to/ffmpeg",        // FFmpeg binary location
    "outputPath": "/path/to/mp3/folder",    // Output file location (default: the home directory)
    "youtubeVideoQuality": "highestaudio",  // Desired video quality (default: highestaudio)
    "queueParallelism": 2,                  // Download parallelism (default: 1)
    "progressTimeout": 2000,                // Interval in ms for the progress reports (default: 1000)
    "allowWebm": false                      // Enable download from WebM sources (default: false)
});

//Download video and save as MP3 file
YD.download("Vhd6Kc4TZls");

YD.on("finished", function(err, data) {
    console.log(JSON.stringify(data));
});

YD.on("error", function(error) {
    console.log(error);
});

YD.on("progress", function(progress) {
    console.log(JSON.stringify(progress));
});

You can also pass a file name for the respective video, which will then be used. Otherwise, the file name will be derived from the video title.

YD.download("Vhd6Kc4TZls", "Cold Funk - Funkorama.mp3");

While downloading, every progressTimeout timeframe, there will be an progress event triggered, outputting an object like

{
    "videoId": "Vhd6Kc4TZls",
    "progress": {
        "percentage": 72.29996914191304,
        "transferred": 19559221,
        "length": 27052876,
        "remaining": 7493655,
        "eta": 2,
        "runtime": 6,
        "delta": 6591454,
        "speed": 3009110.923076923
    }
}

Furthermore, there will be a queueSize event emitted when the queue size changes (both positive and negative). This can be caught via

YD.on("queueSize", function(size) {
    console.log(size);
});

Upon finish, the following output will be returned:

{
    "videoId": "Vhd6Kc4TZls",
    "stats": {
        "transferredBytes": 27052876,
        "runtime": 7,
        "averageSpeed": 3279136.48
    },
    "file": "/path/to/mp3/folder/Cold Funk - Funkorama.mp3",
    "youtubeUrl": "http://www.youtube.com/watch?v=Vhd6Kc4TZls",
    "videoTitle": "Cold Funk - Funkorama - Kevin MacLeod | YouTube Audio Library",
    "artist": "Cold Funk",
    "title": "Funkorama",
    "thumbnail": "https://i.ytimg.com/vi/Vhd6Kc4TZls/hqdefault.jpg"
}

Detailed example

To use it in a class which provides the downloading functionality, you could use it like the following (which can also be found in the examples subfolder of this project):

downloader.js

var YoutubeMp3Downloader = require("youtube-mp3-downloader");

var Downloader = function() {

    var self = this;
    
    //Configure YoutubeMp3Downloader with your settings
    self.YD = new YoutubeMp3Downloader({
        "ffmpegPath": "/path/to/ffmpeg",        // FFmpeg binary location
        "outputPath": "/path/to/mp3/folder",    // Output file location (default: the home directory)
        "youtubeVideoQuality": "highestaudio",  // Desired video quality (default: highestaudio)
        "queueParallelism": 2,                  // Download parallelism (default: 1)
        "progressTimeout": 2000                 // Interval in ms for the progress reports (default: 1000)
        "outputOptions" : ["-af", "silenceremove=1:0:-50dB"] // Additional output options passend to ffmpeg
    });

    self.callbacks = {};

    self.YD.on("finished", function(error, data) {
		
        if (self.callbacks[data.videoId]) {
            self.callbacks[data.videoId](error, data);
        } else {
            console.log("Error: No callback for videoId!");
        }
    
    });

    self.YD.on("error", function(error, data) {
	
        console.error(error + " on videoId " + data.videoId);
    
        if (self.callbacks[data.videoId]) {
            self.callbacks[data.videoId](error, data);
        } else {
            console.log("Error: No callback for videoId!");
        }
     
    });

};

Downloader.prototype.getMP3 = function(track, callback){

    var self = this;
	
    // Register callback
    self.callbacks[track.videoId] = callback;
    // Trigger download
    self.YD.download(track.videoId, track.name);

};

module.exports = Downloader;

This class can then be used like this:

example1.js

var Downloader = require("./downloader");
var dl = new Downloader();
var i = 0;

dl.getMP3({videoId: "Vhd6Kc4TZls", name: "Cold Funk - Funkorama.mp3"}, function(err,res){
    i++;
    if(err)
        throw err;
    else{
        console.log("Song "+ i + " was downloaded: " + res.file);
    }
});
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].