Node-ytdl-core: Filter hasAudio not working

Created on 24 Oct 2020  路  6Comments  路  Source: fent/node-ytdl-core

I'm using the version 3.4.2.
While I debug the code after executing this:

const options = {
        quality: 'highest',
        filter: format => format.hasAudio === false && format.hasVideo == true
      };

      ytdl.getInfo(url,options)

the formats on utils.js L93 contains values with hasAudio = true. What should I change in the code?

On the version 2 I was using this successfully:

const options = {
        quality: 'highest',
        filter: 'audioandvideo'
      };

Thanks so much

bug support

All 6 comments

what formats do you get and what do you expect to get?

It was just a check for being sure the filter was working. My final code would beformat.hasAudio === true && format.hasVideo == true. By setting format.hasAudio to false I was expecting that the array of formats would contain ONLY the ones with hasAudio= false, but I am getting all of them. So I wonder if I have a syntax error on the filter.

ytdl.getInfo(xxx) does not filter the formats / support quality and filter parameter
that's a parameter ytdl(xxx) or ytdl.downloadFromInfo(xxx) support

if you want to filter results of ytdl.getInfo(xxx) you can use https://github.com/fent/node-ytdl-core#ytdlchooseformatformats-options which we also use internally

I was following the options typing. I think it should be changed then?
function getInfo(url: string, options?: downloadOptions): Promise;

that's the point i'd call it a bug 馃槄

yep, i've already updated the readme to reflect that. need to update typings too.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MidSpike picture MidSpike  路  4Comments

adamwoo2444 picture adamwoo2444  路  5Comments

FireController1847 picture FireController1847  路  5Comments

GamerXD4 picture GamerXD4  路  5Comments

r0hin picture r0hin  路  3Comments