youtube-mp3-downloader
Advanced tools
Comparing version 0.4.1 to 0.4.2
@@ -16,5 +16,6 @@ "use strict"; | ||
self.youtubeVideoQuality = (options && options.youtubeVideoQuality ? options.youtubeVideoQuality : 'highest'); | ||
self.outputPath = (options && options.outputPath ? options.outputPath : (os.platform() === 'win32' ? 'D:/temp' : '/tmp')); | ||
self.outputPath = (options && options.outputPath ? options.outputPath : (os.platform() === 'win32' ? 'C:/Windows/Temp' : '/tmp')); | ||
self.queueParallelism = (options && options.queueParallelism ? options.queueParallelism : 1); | ||
self.progressTimeout = (options && options.progressTimeout ? options.progressTimeout : 1000); | ||
self.fileNameReplacements = [[/"/g, ''], [/'/g, ''], [/\//g, ''], [/\?/g, ''], [/:/g, ''], [/;/g, '']]; | ||
@@ -40,2 +41,12 @@ if (options && options.ffmpegPath) { | ||
YoutubeMp3Downloader.prototype.cleanFileName = function(fileName) { | ||
var self = this; | ||
self.fileNameReplacements.forEach(function(replacement) { | ||
fileName = fileName.replace(replacement[0], replacement[1]); | ||
}); | ||
return fileName; | ||
}; | ||
YoutubeMp3Downloader.prototype.download = function(videoId, fileName) { | ||
@@ -67,3 +78,3 @@ | ||
var videoTitle = info.title.replace(/"/g, '').replace(/'/g, '').replace(/\//g, '').replace(/\?/g, ''); | ||
var videoTitle = self.cleanFileName(info.title); | ||
var artist = "Unknown"; | ||
@@ -70,0 +81,0 @@ var title = "Unknown"; |
{ | ||
"name": "youtube-mp3-downloader", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "Downloads Youtube videos (in parallel, as streams), encodes the audio data as mp3 and stores them in a defineable location", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -60,5 +60,4 @@ # Youtube MP3 Downloader | ||
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. | ||
``` | ||
```javascript | ||
YD.download("xh0ctVznxdM", "Winter By CyberSDF.mp3"); | ||
``` | ||
@@ -68,3 +67,3 @@ | ||
``` | ||
```javascript | ||
{ | ||
@@ -87,3 +86,3 @@ "videoId": "xh0ctVznxdM", | ||
``` | ||
```javascript | ||
YD.on("queueSize", function(size) { | ||
@@ -117,3 +116,3 @@ console.log(size); | ||
**Downloader.js** | ||
``` | ||
```javascript | ||
var YoutubeMp3Downloader = require('youtube-mp3-downloader'); | ||
@@ -167,3 +166,3 @@ | ||
**usage.js** | ||
``` | ||
```javascript | ||
var Downloader = require("./Downloader"); | ||
@@ -170,0 +169,0 @@ var dl = new Downloader(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
119
12921
184