因此,我试图处理 ytdl 方法的承诺拒绝,我发现事件处理程序不适用于 ytdl 方法。
const video = new Promise((resolve, reject) => {
ytdl(videoUrl, { filter: format => format.itag == itag })
.on('error', (err) => reject(err))
.on('finish', () => resolve());
}).then(console.log('completed')).catch(err => console.log(err))