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

Commit

Permalink
print warning when getting warnings from stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
fent committed Mar 24, 2015
1 parent c3c1b4b commit 26bd213
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/youtube-dl.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ fs.exists(ytdlBinary, function(exists) {
}
});

var isDebug = /[debug]/;
var isDebug = /^\[debug\] /;
var isWarning = /^WARNING: /;
var isYouTubeRegex = /^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.be)\//;
var isNoSubsRegex =
/WARNING: video doesn't have subtitles|no closed captions found/;
Expand Down Expand Up @@ -146,6 +147,8 @@ function call(urls, args1, args2, options, callback) {

if (isDebug.test(stderr) && args.indexOf('--verbose') > -1) {
console.log('\n' + stderr);
} else if (isWarning.test(stderr)) {
console.warn(stderr);
} else {
return callback(new Error(stderr.slice(7)));
}
Expand Down

0 comments on commit 26bd213

Please sign in to comment.