Skip to content

best way to save what you love

api/youtube: add support for youtubeVideoContainer

wukko33c801f66b29
diff --git a/api/src/processing/match.js b/api/src/processing/match.js
index eb1425ba..11e2b9ab 100644
--- a/api/src/processing/match.js
+++ b/api/src/processing/match.js
@@ -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;
diff --git a/api/src/processing/services/youtube.js b/api/src/processing/services/youtube.js
index 73731ef9..b26f7358 100644
--- a/api/src/processing/services/youtube.js
+++ b/api/src/processing/services/youtube.js
@@ -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);