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

Commit

Permalink
fix parsing resolutions
Browse files Browse the repository at this point in the history
  • Loading branch information
fent committed Jun 14, 2014
1 parent 7acea1e commit ac48c37
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/youtube-dl.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function filterData(data) {
}


var resolutionRegex = /([0-9]+ - [0-9]+x[0-9]+)/;
var resolutionRegex = /([0-9]+ - ([0-9]+x[0-9]+|\d+p))/;

/**
* Gets info from a video.
Expand Down Expand Up @@ -181,7 +181,7 @@ ytdl.getInfo = function(url, args, options, callback) {
};


var formatsRegex = /^(\d+)\s+([a-z0-9]+)\s+(\d+x\d+|d+p|audio only)/;
var formatsRegex = /^(\d+)\s+([a-z0-9]+)\s+(\d+x\d+|\d+p|audio only)/;

/**
* @param {String} url
Expand Down
7 changes: 7 additions & 0 deletions test/getFormat.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ var video = 'http://www.youtube.com/watch?v=0k2Zzkw_-0I';
var expected = [
{ id: '0k2Zzkw_-0I', itag: 171, filetype: 'webm', resolution: 'audio only' },
{ id: '0k2Zzkw_-0I', itag: 140, filetype: 'm4a', resolution: 'audio only' },
{ id: '0k2Zzkw_-0I', itag: 160, filetype: 'mp4', resolution: '144p' },
{ id: '0k2Zzkw_-0I', itag: 242, filetype: 'webm', resolution: '240p' },
{ id: '0k2Zzkw_-0I', itag: 133, filetype: 'mp4', resolution: '240p' },
{ id: '0k2Zzkw_-0I', itag: 243, filetype: 'webm', resolution: '360p' },
{ id: '0k2Zzkw_-0I', itag: 134, filetype: 'mp4', resolution: '360p' },
{ id: '0k2Zzkw_-0I', itag: 244, filetype: 'webm', resolution: '480p' },
{ id: '0k2Zzkw_-0I', itag: 135, filetype: 'mp4', resolution: '480p' },
{ id: '0k2Zzkw_-0I', itag: 17, filetype: '3gp', resolution: '176x144' },
{ id: '0k2Zzkw_-0I', itag: 36, filetype: '3gp', resolution: '320x240' },
{ id: '0k2Zzkw_-0I', itag: 5, filetype: 'flv', resolution: '400x240' },
Expand Down

0 comments on commit ac48c37

Please sign in to comment.