We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2e161fe commit d80d565Copy full SHA for d80d565
index.js
@@ -9,12 +9,12 @@ function filter(format) {
9
10
module.exports = function download(url, options = {}) {
11
return new Promise((resolve, reject) => {
12
- Object.assign(options, { filter: 'audioonly' });
13
ytdl.getInfo(url, (err, info) => {
14
if (err) return reject(err);
15
// Prefer opus
16
const canDemux = info.formats.find(filter) && info.length_seconds != 0;
17
if (canDemux) Object.assign(options, { filter });
+ else if (info.length_seconds != 0) Object.assign(options, { filter: 'audioonly' });
18
const ytdlStream = ytdl.downloadFromInfo(info, options);
19
if (canDemux) {
20
const demuxer = new prism.opus.WebmDemuxer();
0 commit comments