Option quality with highest or lowest doesn't work anymore since v4
- Dominant language
- JavaScript
- Stars
- 4.7k
- Forks
- 852
- PR merge metrics
- No merged PRs in 30d
Description
Hey, thanks for this great package! 🙂
It seems that the `quality` option with values like `highest` or `lowest` doesn't work anymore since v4. In this example, we have:
```js
ytdl('aqz-KE-bpKQ', { quality: 'highest' }) // => itag 22 / 720p with v3.4.2
ytdl('aqz-KE-bpKQ', { quality: 'highest' }) // => itag 18 / 360p with v4.0.3
```
It seems that the `sortFormats` method has changed between v3 and v4 and no longer returns the same order:
https://github.com/fent/node-ytdl-core/blob/4a017941c87d56181e0a510c1346dad3cc24a75e/lib/info.js#L285
```js
[22, 18, 315, 308, 299, 303, 399, 298, 302, 136, 398, 247, 135, 244, 397, 134, 243, 396, 133, 242, 395, 160, 278, 394, 251, 140, 250, 249, 258, 256] // => with v3.4.2
[18, 315, 308, 299, 303, 399, 298, 302, 136, 398, 247, 135, 244, 397, 134, 243, 396, 133, 242, 395, 160, 278, 394, 258, 256, 251, 140, 250, 249, 22] // => with v4.0.3
```
But the indexes mapping didn't change between v3 and v4 which could explain the wrong match:
https://github.com/fent/node-ytdl-core/blob/3f57ce9845cb00502f68e251934c6317a3efad8f/lib/format-utils.js#L110-L116
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.