distubejs / ytdl-core

YouTube video downloader in javascript.
MIT License
213 stars 43 forks source link

Filtering for highestaudio fails #46

Closed benkaiser closed 1 month ago

benkaiser commented 1 month ago

Describe the bug

When running a search for highestaudio

const ytdl = require("@distube/ytdl-core");

ytdl.getBasicInfo("https://www.youtube.com/watch?v=1ec4gu5uJ6U").then(info => {
  console.log(info.formats);
  console.log(ytdl.chooseFormat(info.formats, { quality: 'highestaudio' }));
});

It fails returning:

Error: No such format found: highestaudio

But if you inspect the list of formats, there are many audio formats.

The issue seems to stem from none of the formats being marked with .hasAudio, because the formats themselves have no audioBitrate property on them.

Environment

benkaiser commented 1 month ago

My issue was using .getBasicInfo instead of .getInfo. Closing.