distubejs / ytdl-core

YouTube video downloader in javascript.
MIT License
289 stars 50 forks source link

filterFormats Error #118

Closed makotocolors closed 1 month ago

makotocolors commented 1 month ago

In the current implementation of the module, a bug has been identified within the filterFormats function. This bug results in the function returning an empty array when the filter is set to either "videoandaudio" or "audioandvideo." This issue was not present in earlier versions of the module; therefore, reverting to version 4.14.4 is necessary to restore the functionality of the format filtering feature. The regression in functionality affects users relying on these specific filter configurations.

HugoLibanori commented 1 month ago

same error here.

Talgoo commented 1 month ago

Same here, I think it started at 4.15.0

skick1234 commented 1 month ago

Since YouTube has removed nearly all formats that include both video and audio, you can utilize the ANDROID or WEB client to access itag 18. The default clients, IOS and WEB_CREATOR, do not support this format. Consider using a combination of formats for enhanced quality.

ytdl.getInfo("...", {
  playerClients: ["IOS", "WEB_CREATOR", "ANDROID", "WEB"]
}).then(info => {
  const formats = ytdl.filterFormats(info.formats, "videoandaudio");
  console.log(formats);
});
Talgoo commented 1 month ago

I think the docs should be updated with this.

makotocolors commented 1 month ago

Since YouTube has removed nearly all formats that include both video and audio, you can utilize the ANDROID or WEB client to access itag 18. The default clients, IOS and WEB_CREATOR, do not support this format. Consider using a combination of formats for enhanced quality.

ytdl.getInfo("...", {
  playerClients: ["IOS", "WEB_CREATOR", "ANDROID", "WEB"]
}).then(info => {
  const formats = ytdl.filterFormats(info.formats, "videoandaudio");
  console.log(formats);
});

It worked, thx