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

handle new warning style #46

Merged
merged 3 commits into from
Oct 24, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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