Git Product home page Git Product logo

youtube-mp3-downloader's Introduction

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);
    }
});

youtube-mp3-downloader's People

Contributors

akoskoc avatar djeeberjr avatar etiaro avatar harrylincoln avatar ishahin avatar jszaday avatar marcalcaraz avatar marlons91 avatar moshfeu avatar mpirescarvalho avatar nehoraigold avatar qaraluch avatar sebastianprem avatar sebastiansandqvist avatar tobilg avatar ytb2mp3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

youtube-mp3-downloader's Issues

version **0.7.0** code errors

Errors are thrown when calling download() function

File: YoutubeMp3Downloader.js
Line: 52
Code : download = function(videoId, fileName) {
Error message: SyntaxError: Unexpected token =

Respond Error

How To Fix..

Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('Status code: 429')

Please, Help Me.

Display DL progress to user

I wrote a simple node.js app that takes a youtube url, downloads the mp3 and then sends it to the user. The download seems to work OK, but I would like to display the completion percentage on the user's browser (more than anything so that they don't think that nothing is happening). Is this even possible? TIA

Example logs error, but doesn't do anything with it.

I'm pretty much using your example, and it works wonderfully. With the exception that it doesn't actually do anything with an error besides log it to console and then go on and crash because it continues even though there is an error.
From what I understand, if there is an error there should be a callback returning the error. How could I get the callback and return an error when it occurs when I don't have access to the data to retrieve the callback?
Any help would be appreciated ๐Ÿ˜„

Error spawn ENOENT

Every time I try to download, I receive this specific error :

Error: spawn D:/User/Documents/Programming/project/src/downloads/youtube-mp3/ffmpeg ENOENT
        at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19)
        at onErrorNT (internal/child_process.js:468:16)
        at processTicksAndRejections (internal/process/task_queues.js:80:21) {
      errno: -4058,
      code: 'ENOENT',
      syscall: 'spawn D:/User/Documents/Programming/project/src/downloads/youtube-mp3/ffmpeg',
      path: 'D:/User/Documents/Programming/project/src/downloads/youtube-mp3/ffmpeg',
      spawnargs: [ '-formats' ]
    }

This folder existed yet, how can i fix this error ?

Update ytdl-core@latest

Hi @ytb2mp3 ......
youtube-mp3-downloader is throwing error with 3.2.0
New version of ytdl-core is out. ( 4.0.1 )
Your package dependency needs to be updated.

Progress bar

Hi, nice plugin.
How i can implement progress bar?

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

How i can send it to the client side? Should i send file via xhr??

File downloads twice in example

In your example1.js which leverages downloader.js, I find that the file downloads twice... once with a proper filename specified in the getMP3 function and another file "Funk" gets put in the root directory of the project. Any ideas?

Uncaught errors

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

This method of catching a error with a download is not catching errors with YTDL such as

(Mini-Get is the http GET client used by ytdl-core)
2017-07-12 07:52 -05:00: Error: Status code: 500 at ClientRequest.<anonymous> (sanatized-path\node_modules\miniget\lib\index.js:65:17) at Object.onceWrapper (events.js:316:30) at emitOne (events.js:115:13) at ClientRequest.emit (events.js:210:7) at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:564:21) at HTTPParser.parserOnHeadersComplete (_http_common.js:116:23) at TLSSocket.socketOnData (_http_client.js:453:20) at emitOne (events.js:115:13) at TLSSocket.emit (events.js:210:7) at addChunk (_stream_readable.js:252:12) at readableAddChunk (_stream_readable.js:239:11) at TLSSocket.Readable.push (_stream_readable.js:197:10) at TLSWrap.onread (net.js:588:20)

Error: Callback was already called

I'm getting this error sometimes:

Error: Callback was already called.
    at /app/node_modules/async/dist/async.js:318:36
    at /app/node_modules/youtube-mp3-downloader/lib/YoutubeMp3Downloader.js:39:17
    at FfmpegCommand.<anonymous> (/app/node_modules/youtube-mp3-downloader/lib/YoutubeMp3Downloader.js:161:17)
    at FfmpegCommand.emit (events.js:314:20)
    at emitEnd (/app/node_modules/fluent-ffmpeg/lib/processor.js:426:16)
    at endCB (/app/node_modules/fluent-ffmpeg/lib/processor.js:587:15)
    at handleExit (/app/node_modules/fluent-ffmpeg/lib/processor.js:170:11)
    at ChildProcess.<anonymous> (/app/node_modules/fluent-ffmpeg/lib/processor.js:184:11)
    at ChildProcess.emit (events.js:314:20)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)

A way to limit video length/A way to edit start and end times for the video (i.g. 01:22-12:30)

I'm trying to prevent users from being able to upload videos that have like a 10 hour long length so as to not bog up my servers. I can't seem to find anything about this on the docs or when searching online. Is this not a feature yet?

Also being able to edit start and end times to clip the video would be nice. I of course know that's possible with ffmpeg but if it could be done more efficiently at the beginning so that actually only the clipped portion of the video is captured/downloaded by the YouTube-mp3-downloader package. Thanks

Option to define output file name

Currently, the video name is the name of the file saved.

Could you add a feature where a filename can be passed in, like this:

YD.download([vid], filename, function(result) {
    console.log(result);
});

and the file would be saved as filename.

problem with progress event after update

Something bad happened with progress event during recent update, I guess.

{ videoId: 'aflmCuUfq-I',
  progress:
   { percentage: 0,
     transferred: 6275788,
     length: 0,
     remaining: 0,
     eta: 0,
     runtime: 3,
     delta: 2719728,
     speed: 1793082.2857142857 } }

Emitted object has wrong percentage, length, remaining and eta values.
Please check it out cause I can not figure it out what wrong happened.

Update

Update dependencies, please.
Especially ytdl-core.

Some videos are not downloading

Most videos are downloadable but sometimes when I start a download the video doesn't download and no error message triggers

Finished event is emitted multiple times

The finished event is emitted multiple times!

When I set a recursive function that request n files recursively, each files get the finished multiple times

 YD.on("finished", function(data) {
      callback(null,"update")
 });

the callback is called multiple times on the same file.

Can youtube block our server for using this package?

I have installed this on my server and it was working fine then suddenly it stopped working and "progress" event shows null in console

youtubeDownloader.on("progress", function (progress) {
                    console.log(progress.progress);
});

Error: Status code: 403

The package is no longer functional. My web server keeps crashing every time I try to use the module due to a failing dependency.

error

Unhandled promise rejection warning and Deprecation Warning

Hi,

I am running example/example1.js and getting the following error:

(node:18758) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:18758) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Kindly help me out to solve this error.

Kind Regards,

Error: this video is unavailable

Hi,

For some Youtube Videos, not all, I get this error after running the code.

For instance UNA3Laa3-_Q returns this error message.

This video does exist -> https://www.youtube.com/watch?v=UNA3Laa3-_Q

Command used node app.js UNA3Laa3-_Q

app.js

var youtubeCode = process.argv[2]
console.log("code: " + youtubeCode );
var YoutubeMp3Downloader = require("youtube-mp3-downloader");

//Configure YoutubeMp3Downloader with your settings
var YD = new YoutubeMp3Downloader({
    "ffmpegPath": "C:/Program Files/ffmpeg/bin/ffmpeg.exe",        // Where is the FFmpeg binary located?
//      "ffmpegPath": "/usr/bin/ffmpeg",        // Where is the FFmpeg binary located?
    "outputPath": ".",    // Where should the downloaded and encoded files be stored?
    "youtubeVideoQuality": "highest",       // What video quality should be used?
    "queueParallelism": 2,                  // How many parallel downloads/encodes should be started?
    "progressTimeout": 2000                 // How long should be the interval of the progress reports
});

//Download video and save as MP3 file
YD.download(youtubeCode, "music.mp3");

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));
});

Error: spawn EACCES

I am trying to run it with the example provided but I am getting this error:

$ node index
internal/child_process.js:298
throw errnoException(err, 'spawn');
^

Error: spawn EACCES
at exports._errnoException (util.js:874:11)
at ChildProcess.spawn (internal/child_process.js:298:11)
at exports.spawn (child_process.js:339:9)
at /project/node_modules/youtube-mp3-downloader/node_modules/fluent-ffmpeg/lib/processor.js:135:24
at FfmpegCommand.proto._getFfmpegPath (/project/node_modules/youtube-mp3-downloader/node_modules/fluent-ffmpeg/lib/capabilities.js:90:14)
at FfmpegCommand.proto._spawnFfmpeg (/project/node_modules/youtube-mp3-downloader/node_modules/fluent-ffmpeg/lib/processor.js:115:10)
at FfmpegCommand.proto.availableFormats.proto.getAvailableFormats (/project/node_modules/youtube-mp3-downloader/node_modules/fluent-ffmpeg/lib/capabilities.js:514:10)
at /project/node_modules/youtube-mp3-downloader/node_modules/fluent-ffmpeg/lib/capabilities.js:564:14
at fn (/project/node_modules/youtube-mp3-downloader/node_modules/async/lib/async.js:716:34)
at /project/node_modules/youtube-mp3-downloader/node_modules/async/lib/async.js:1169:16

did you see this problem ?

C02T30AMG8WL-lm:ex1 peterchang$ node youtube-mp3-download.js
internal/child_process.js:313
throw errnoException(err, 'spawn');
^

Error: spawn EACCES
at exports._errnoException (util.js:1023:11)
at ChildProcess.spawn (internal/child_process.js:313:11)
at exports.spawn (child_process.js:387:9)
at /Users/peterchang/Desktop/node/soundcloud/ex1/node_modules/fluent-ffmpeg/lib/processor.js:135:24
at FfmpegCommand.proto._getFfmpegPath (/Users/peterchang/Desktop/node/soundcloud/ex1/node_modules/fluent-ffmpeg/lib/capabilities.js:90:14)
at FfmpegCommand.proto._spawnFfmpeg (/Users/peterchang/Desktop/node/soundcloud/ex1/node_modules/fluent-ffmpeg/lib/processor.js:115:10)
at FfmpegCommand.proto.availableFormats.proto.getAvailableFormats (/Users/peterchang/Desktop/node/soundcloud/ex1/node_modules/fluent-ffmpeg/lib/capabilities.js:514:10)
at /Users/peterchang/Desktop/node/soundcloud/ex1/node_modules/fluent-ffmpeg/lib/capabilities.js:564:14
at fn (/Users/peterchang/Desktop/node/soundcloud/ex1/node_modules/async/lib/async.js:582:34)
at Immediate. (/Users/peterchang/Desktop/node/soundcloud/ex1/node_modules/async/lib/async.js:498:34)

Videos with colons results in file name halts

When downloading a video with a ":" in it, the file name halts it's output when that happens, so for example: Emotional OST of the Day(Day51): Steins;Gate - Solitude will result in "Emotional OST of the Day(Day51) being downloaded, which, in turn has some implication for another thing I'm implementing this into.

Error parsing config

Does not load any videos
Error parsing config: Unexpected token ; in JSON at position 186786
Screen Shot 2020-07-30 at 07 16 26

ffmpeg crash when using max queueParalellism

ffmpeg exits with code 1 and async.js throws an error that "Callback was already called"

When I increase the queue max I can run more instances but I cannot reach this max or else it will error out. This only crashes the program after the conversion is complete and just seems like a bug.

Error message:
https://pastebin.com/sBB0hbz1

Here's my code that I'm currently using:
https://pastebin.com/ncED4DhN

Any help with this would be much appreciated and the only reason I figured this out is I am running it on a raspberry pi 1 so I set the max queue to 1 and it crashed every time.

Linux Raspbian version: 6.3.0-18
ffmpeg version: 3.2.12-1
nodejs version: 1.4.21

Error

Hello, Can U Help Me ?
How To Fix This..

(node:14408) UnhandledPromiseRejectionWarning: Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('Could not find player config')
at YoutubeMp3Downloader.emit (events.js:303:17)

Request music error, how to fix. thanks

Error: spawn EACCES

hi. hope u have mme at this error.
when i use "node index.js" to run that script . this error show:
$ node index.js
internal/child_process.js:330
throw errnoException(err, 'spawn');
^

Error: spawn EACCES
at ChildProcess.spawn (internal/child_process.js:330:11)
at exports.spawn (child_process.js:500:9)
at /Users/trungnq/Projects/myplan/ytdownloader/node_modules/fluent-ffmpeg/lib/processor.js:152:24
at FfmpegCommand.proto._getFfmpegPath (/Users/trungnq/Projects/myplan/ytdownloader/node_modules/fluent-ffmpeg/lib/capabilities.js:90:14)
at FfmpegCommand.proto._spawnFfmpeg (/Users/trungnq/Projects/myplan/ytdownloader/node_modules/fluent-ffmpeg/lib/processor.js:132:10)
at FfmpegCommand.proto.availableFormats.proto.getAvailableFormats (/Users/trungnq/Projects/myplan/ytdownloader/node_modules/fluent-ffmpeg/lib/capabilities.js:517:10)
at /Users/trungnq/Projects/myplan/ytdownloader/node_modules/fluent-ffmpeg/lib/capabilities.js:568:14
at nextTask (/Users/trungnq/Projects/myplan/ytdownloader/node_modules/async/dist/async.js:5310:14)
at Object.waterfall (/Users/trungnq/Projects/myplan/ytdownloader/node_modules/async/dist/async.js:5320:5)
at FfmpegCommand.proto._checkCapabilities (/Users/trungnq/Projects/myplan/ytdownloader/node_modules/fluent-ffmpeg/lib/capabilities.js:565:11)
How to fix that? thank u!

youtube-mp3-downloader npm not working for the youtube ID -> 60ItHLz5WEA .

Hey,
I just tried to download this famous song named faded
https://www.youtube.com/watch?v=60ItHLz5WEA

`var YoutubeMp3Downloader = require("youtube-mp3-downloader");
const config = require('./config/config.js');

//Configure YoutubeMp3Downloader with your settings
var YD = new YoutubeMp3Downloader({
"ffmpegPath": config.ffmpegPath,
"outputPath": config.outputPath,
"youtubeVideoQuality": config.youtubeVideoQuality,
"queueParallelism": config.queueParallelism,
"progressTimeout": config.progressTimeout
});

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

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));
});`

But it is throwing following error

url.js:154
throw new ERR_INVALID_ARG_TYPE('url', 'string', url);
^

TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received type undefined
at Url.parse (url.js:154:11)
at Object.urlParse [as parse] (url.js:148:13)
at doDownload (...\node_modules\miniget\dist\index.js:90:28)
at process._tickCallback (internal/process/next_tick.js:61:11)

Please help

Note that code works well for all other ids

ffmpeg exited with code 1

hi, i have installed your plugin.

Here us what i am try

var express = require('express');
var router = express.Router();
const path = require('path');
var YoutubeMp3Downloader = require("youtube-mp3-downloader");
const saveFolder = path.join(__dirname, '../public/uploads');


router.get('/', function(req, res, next) {
    //Configure YoutubeMp3Downloader with your settings
    var YD = new YoutubeMp3Downloader({
        "ffmpegPath": "/usr/local/Cellar/ffmpeg/3.4/bin/ffmpeg",        // Where is the FFmpeg binary located?
        "outputPath": saveFolder,    // Where should the downloaded and encoded files be stored?
        "youtubeVideoQuality": "highest",       // What video quality should be used?
        "queueParallelism": 2,                  // How many parallel downloads/encodes should be started?
        "progressTimeout": 2000                 // How long should be the interval of the progress reports
    });

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

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

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

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

});

module.exports = router;

in terminal i have:

GET /upload - - ms - -
error
ffmpeg exited with code 1: /Users/donika/Sites/slim-ytb/public/uploads/Major Lazer - Sua Cara (feat. Anitta & Pabllo Vittar) (Official Music Video).mp3: No such file or directory

error
ffmpeg exited with code 1: /Users/donika/Sites/slim-ytb/public/uploads/Major Lazer - Sua Cara (feat. Anitta & Pabllo Vittar) (Official Music Video).mp3: No such file or directory

GET /upload - - ms - -
error
ffmpeg exited with code 1: /Users/donika/Sites/slim-ytb/public/uploads/Major Lazer - Sua Cara (feat. Anitta & Pabllo Vittar) (Official Music Video).mp3: No such file or directory

Can you help me with this?

Add album art

How would I add album art? I'm looking for something like this:

.outputOptions('-metadata', 'title=' + songTitle)
.outputOptions('-metadata', 'artist=' + songArtist)
.outputOptions('-metadata', 'albumArt=' + base64image)

or

.outputOptions('-metadata', 'title=' + songTitle)
.outputOptions('-metadata', 'artist=' + songArtist)
.outputOptions('-metadata', 'albumArt=' + pathToImage)

Error 429

how to fix this error?

0|p | Error: Status code: 429
0|p |     at ClientRequest.<anonymous> (/root/bot/node_modules/miniget/dist/index.js:150:31)
0|p |     at Object.onceWrapper (events.js:422:26)
0|p |     at ClientRequest.emit (events.js:315:20)
0|p |     at ClientRequest.EventEmitter.emit (domain.js:483:12)
0|p |     at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:596:27)
0|p |     at HTTPParser.parserOnHeadersComplete (_http_common.js:119:17)
0|p |     at TLSSocket.socketOnData (_http_client.js:469:22)
0|p |     at TLSSocket.emit (events.js:315:20)
0|p |     at TLSSocket.EventEmitter.emit (domain.js:483:12)
0|p |     at addChunk (_stream_readable.js:295:12)
0|p |     at readableAddChunk (_stream_readable.js:271:9)
0|p |     at TLSSocket.Readable.push (_stream_readable.js:212:10)
0|p |     at TLSWrap.onStreamRead (internal/stream_base_commons.js:186:23)

ffmpeg exited with code 1

I'm getting errors on some videos that I can't figure out why or how to solve. I always get the error on some videos like 2ky7V-jMcZI

here's my code:

const YD = new YoutubeMp3Downloader({
      ffmpegPath: 'ffmpeg',
      outputPath: 'temp/audio',
      youtubeVideoQuality: 'highestaudio',
      queueParallelism: 1,
      progressTimeout: 2000,
      allowWebm: true,
    });

    YD.download('2ky7V-jMcZI', 'test.mp3');

    YD.on('finished', async (error, data) => {
      console.log(!error ? 'success' : error);
    });

    YD.on('error', error => console.log(error));

here's the output:

ffmpeg exited with code 1: Error initializing output stream 0:0 -- Error while opening encoder for output stream 
#0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!

Err: Too many reconnects

I get the following error when downloading certain youtube videos. It seems to get a certain percentage of the video and then it fails, on this playlist usually around 100-200 songs in, never the same song. Is there a way to skip the break out of the download function if the percentage gets stuck? https://www.youtube.com/playlist?list=PLJKDxKDJBeYnen4wYXDY8jhlcZsDAsaT6

events.js:136
      throw er; // Unhandled 'error' event
      ^

Error: Too many reconnects
    at doDownload (/Users/sam/personal/youtubejoel/node_modules/ytdl-core/lib/index.js:110:26)
    at PassThrough.onend (/Users/sam/personal/youtubejoel/node_modules/ytdl-core/lib/index.js:152:7)
    at PassThrough.emit (events.js:164:20)
    at endReadableNT (_stream_readable.js:1054:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

After update, I have new error

/usr/src/node_modules/youtube-mp3-downloader/lib/YoutubeMp3Downloader.js:47
fileName = fileName.replace(replacement[0], replacement[1]);
^
TypeError: Cannot read property 'replace' of undefined
at /usr/src/node_modules/youtube-mp3-downloader/lib/YoutubeMp3Downloader.js:47:29

YD.Download() throwing ECONNREFUSED Error

When I use the example script to try to get an MP3 when it reaches YD.Download() it throws an error stating:
connect ECONNREFUSED 127.0.0.1:80
I have tried troubleshooting but I cannot figure out why it isn't working.

Ffmpeg

Should i write file 'ffmpeg.exe' location in "ffmpegPath", in constructor, or just its folder? Both not working(

Unable to upload to Heroku

Hi Team,

I was able to get the library locally on my windows machine using ffmpeg.exe.

Any idea how to upload this to heroku ?

Downloading speed is low.

Hello,

I have an issue about the downloading speed, is pretty low even if my downloading speed is very high. There is anything in the code that makes hinders the speed?

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.