api/youtube: expect one of itags to be empty

This commit is contained in:
jj 2025-01-20 20:12:21 +00:00
parent 0ab3fe4d2a
commit ee3ef60a20
No known key found for this signature in database

View file

@ -351,7 +351,7 @@ export default async function (o) {
Number(b.bitrate) - Number(a.bitrate) Number(b.bitrate) - Number(a.bitrate)
).forEach(format => { ).forEach(format => {
Object.keys(codecList).forEach(yCodec => { Object.keys(codecList).forEach(yCodec => {
const matchingItag = slot => !itag || itag[slot] === format.itag; const matchingItag = slot => !itag?.[slot] || itag[slot] === format.itag;
const sorted = sorted_formats[yCodec]; const sorted = sorted_formats[yCodec];
const goodFormat = checkFormat(format, yCodec); const goodFormat = checkFormat(format, yCodec);
if (!goodFormat) return; if (!goodFormat) return;
@ -453,8 +453,8 @@ export default async function (o) {
} }
itag = { itag = {
video: video.itag, video: video?.itag,
audio: audio.itag audio: audio?.itag
}; };
const originalRequest = { const originalRequest = {