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

Commit

Permalink
Merge pull request #46 from przemyslawpluta/master
Browse files Browse the repository at this point in the history
handle new warning style
  • Loading branch information
fent committed Oct 24, 2014
2 parents f315043 + 97346fe commit ee04e43
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions lib/youtube-dl.js
Expand Up @@ -18,7 +18,7 @@ fs.exists(file, function(exists) {

var isDebug = /[debug]/;
var isYouTubeRegex = /^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.be)\//;
var isNoSubsRegex = /WARNING: video doesn't have subtitles/;
var isNoSubsRegex = /WARNING: video doesn't have subtitles|no closed captions found/;
var subsRegex = /--write-sub|--write-srt|--srt-lang|--all-subs/;

// Check if win.
Expand Down Expand Up @@ -123,7 +123,7 @@ function call(video, args1, args2, options, callback) {
if (!options.nosubs && isNoSubsRegex.test(stderr)) {

var i;
var cleanupOpt = opt[1];
var cleanupOpt = args2;

for (i = cleanupOpt.length - 1; i >= 0; i--) {
if (subsRegex.test(cleanupOpt[i])) { cleanupOpt.splice(i, 1); }
Expand Down
21 changes: 12 additions & 9 deletions test/getFormat.js
Expand Up @@ -5,20 +5,23 @@ 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: 139, filetype: 'm4a', 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: 171, filetype: 'webm', resolution: 'audio only' },
{ id: '0k2Zzkw_-0I', itag: 141, filetype: 'm4a', resolution: 'audio only' },
{ id: '0k2Zzkw_-0I', itag: 172, filetype: 'webm', resolution: 'audio only' },
{ id: '0k2Zzkw_-0I', itag: 160, filetype: 'mp4', resolution: '192x144' },
{ id: '0k2Zzkw_-0I', itag: 242, filetype: 'webm', resolution: '320x240' },
{ id: '0k2Zzkw_-0I', itag: 133, filetype: 'mp4', resolution: '320x240' },
{ id: '0k2Zzkw_-0I', itag: 243, filetype: 'webm', resolution: '480x360' },
{ id: '0k2Zzkw_-0I', itag: 134, filetype: 'mp4', resolution: '480x360' },
{ id: '0k2Zzkw_-0I', itag: 244, filetype: 'webm', resolution: '640x480' },
{ id: '0k2Zzkw_-0I', itag: 135, filetype: 'mp4', resolution: '640x480' },
{ 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' },
{ id: '0k2Zzkw_-0I', itag: 43, filetype: 'webm', resolution: '640x360' },
{ id: '0k2Zzkw_-0I', itag: 18, filetype: 'mp4', resolution: '640x360' }
{ id: '0k2Zzkw_-0I', itag: 18, filetype: 'mp4', resolution: '640x360'}
];

vows.describe('getFormats').addBatch({
Expand Down

0 comments on commit ee04e43

Please sign in to comment.