api/youtube: add support for youtubeVideoContainer

This commit is contained in:
wukko 2025-06-20 14:35:43 +06:00
parent eb249a3eed
commit 33c801f66b
No known key found for this signature in database
GPG Key ID: 3E30B3F26C7B4AA2
2 changed files with 9 additions and 8 deletions

View File

@ -112,7 +112,8 @@ export default async function({ host, patternMatch, params, isSession, isApiKey
dispatcher,
id: patternMatch.id.slice(0, 11),
quality: params.videoQuality,
format: params.youtubeVideoCodec,
codec: params.youtubeVideoCodec,
container: params.youtubeVideoContainer,
isAudioOnly,
isAudioMuted,
dubLang: params.youtubeDubLang,
@ -122,7 +123,7 @@ export default async function({ host, patternMatch, params, isSession, isApiKey
if (url.hostname === "music.youtube.com" || isAudioOnly) {
fetchInfo.quality = "1080";
fetchInfo.format = "vp9";
fetchInfo.codec = "vp9";
fetchInfo.isAudioOnly = true;
fetchInfo.isAudioMuted = false;

View File

@ -171,7 +171,7 @@ export default async function (o) {
let innertubeClient = o.innertubeClient || env.customInnertubeClient || "IOS";
// HLS playlists from the iOS client don't contain the av1 video format.
if (useHLS && o.format === "av1") {
if (useHLS && o.codec === "av1") {
useHLS = false;
}
@ -188,8 +188,8 @@ export default async function (o) {
!useHLS
&& innertubeClient === "IOS"
&& (
(quality > 1080 && o.format !== "h264")
|| (quality > 1080 && o.format !== "vp9")
(quality > 1080 && o.codec !== "h264")
|| (quality > 1080 && o.codec !== "vp9")
)
)
);
@ -301,7 +301,7 @@ export default async function (o) {
}
let video, audio, subtitles, dubbedLanguage,
codec = o.format || "h264", itag = o.itag;
codec = o.codec || "h264", itag = o.itag;
if (useHLS) {
const variants = await getHlsVariants(
@ -545,7 +545,7 @@ export default async function (o) {
if (useHLS) {
resolution = normalizeQuality(video.resolution);
filenameAttributes.resolution = `${video.resolution.width}x${video.resolution.height}`;
filenameAttributes.extension = hlsCodecList[codec].container;
filenameAttributes.extension = o.container === "auto" ? hlsCodecList[codec].container : o.container;
video = video.uri;
audio = audio.uri;
@ -556,7 +556,7 @@ export default async function (o) {
});
filenameAttributes.resolution = `${video.width}x${video.height}`;
filenameAttributes.extension = codecList[codec].container;
filenameAttributes.extension = o.container === "auto" ? codecList[codec].container : o.container;
if (!clientsWithNoCipher.includes(innertubeClient) && innertube) {
video = video.decipher(innertube.session.player);