Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Commit

Permalink
drop getFormats, update vimeo test
Browse files Browse the repository at this point in the history
  • Loading branch information
przemyslawpluta committed Sep 28, 2017
1 parent 6f2840e commit da47d4d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 80 deletions.
32 changes: 0 additions & 32 deletions lib/youtube-dl.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,38 +290,6 @@ ytdl.getInfo = function getInfo(url, args, options, callback) {
});
};


/**
* @param {String} url
* @param {!Array.<String>} args
* @param {Function(!Error, Object)} callback
*/
ytdl.getFormats = function getFormats(url, args, callback) {
'use strict';
console.warn('`getFormats()` is deprecated. Please use `getInfo()`');

if (typeof args === 'function') {
callback = args;
args = [];
}

ytdl.getInfo(url, args, {}, function done(err, video_info) {
if (err) { return callback(err); }

var formats_info = video_info.formats || [video_info];
var formats = formats_info.map(function mapIt(format) {
return {
id: video_info.id,
itag: format.format_id,
filetype: format.ext,
resolution: format.format.split(' - ')[1].split(' (')[0],
};
});

callback(null, formats);
});
};

/**
* @param {String} url
* @param {Object} options
Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"video",
"download"
],
"version": "1.11.3",
"version": "1.12.0",
"repository": {
"type": "git",
"url": "git://github.com/stems/node-youtube-dl.git"
Expand All @@ -27,7 +27,7 @@
},
"dependencies": {
"mkdirp": "^0.5.1",
"request": "^2.82.0",
"request": "^2.83.0",
"streamify": "^0.2.9"
},
"devDependencies": {
Expand Down
36 changes: 0 additions & 36 deletions test/getFormat.js

This file was deleted.

4 changes: 2 additions & 2 deletions test/getInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ vows.describe('getInfo').addBatch({
'topic': function() {
'use strict';
var video = 'https://vimeo.com/6586873';
ytdl.getInfo(video, this.callback);
ytdl.getInfo(video, ['--no-warnings'], this.callback);
},

'info returned': function(err, info) {
Expand All @@ -120,7 +120,7 @@ vows.describe('getInfo').addBatch({
'use strict';
var vimeo = 'https://vimeo.com/6586873';
var youtube = 'http://www.youtube.com/watch?v=90AiXO1pAiA';
ytdl.getInfo([vimeo, youtube], this.callback);
ytdl.getInfo([vimeo, youtube], ['--no-warnings'], this.callback);
},

'info returned': function(err, info) {
Expand Down

0 comments on commit da47d4d

Please sign in to comment.