Revert "Revert "Reset playerclients for ytdl during getinfo to defaults""

This commit is contained in:
Michael 2025-01-21 22:36:02 -08:00 committed by GitHub
parent 591e9bab67
commit c2445a7c3c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View file

@ -515,7 +515,7 @@ export default class {
if (!ffmpegInput) {
// Not yet cached, must download
const info = await ytdl.getInfo(song.url);
const info = await ytdl.getInfo(song.url, {playerClients: ['WEB_CREATOR', 'IOS']});
const formats = info.formats as YTDLVideoFormat[];
@ -524,6 +524,10 @@ export default class {
format = formats.find(filter);
const nextBestFormat = (formats: ytdl.videoFormat[]): ytdl.videoFormat | undefined => {
if (formats.length < 1) {
return undefined;
}
if (formats[0].isLive) {
formats = formats.sort((a, b) => (b as unknown as {audioBitrate: number}).audioBitrate - (a as unknown as {audioBitrate: number}).audioBitrate); // Bad typings