代码:
}
exports.downloadVideoYTDL = function(postId, permalink, tempFolder) {
return new Promise(function(resolve, reject) {
ffmpegInstalled()
.then(function(installed) {
if (installed) {
ytdlInstalled()
.then(function(installed2) {
if (!installed2) {
reject("http://ytdl-org.github.io/youtube-dl/download.html ");
return;
}
let url = "https://www.reddit.com" + permalink;
console.log("YT-DL URL: ", url);
let downloadLoc = path.join(tempFolder, postId + "-temp.mp4");
let command = "youtube-dl -o " + downloadLoc + " " + url
console.log(command);
exec(command, function(err, stdout, stderr) {
if (err) {
reject(err);
return;
}
错误:
错误:命令失败:youtube-dl -o D:\Softwares\programming\Insta Bot\redi to insta poster\insta redi poster\temp\qssxlp-temp.mp4 https://www.reddit.com/r/IndianDankMemes/评论/qssxlp/winter_meme_oc/ERROR:固定输出名称,但在 ChildProcess.emit (events.js:400:28) 上可能关闭 (internal/child_process .js:1058:16) 在 Process.ChildProcess._handle.onexit (internal/child_process.js:293:5)(使用node --trace-warnings ...
显示警告的创建位置)(节点:6756)UnhandledPromiseRejectionWarning:未处理的承诺拒绝。此错误源于在没有 catch 块的情况下抛出异步函数内部,或拒绝未使用 .catch() 处理的承诺。要在未处理的 Promise 拒绝时终止节点进程,请使用 CLI 标志--unhandled-rejections=strict
(请参阅https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode)。(拒绝 id:1)(节点:6756)[DEP0018] DeprecationWarning:不推荐使用未处理的承诺拒绝。将来,未处理的 Promise 拒绝将使用非零退出代码终止 Node.js 进程。