mirror of
https://github.com/imputnet/cobalt.git
synced 2025-06-28 09:28:29 +00:00
api/youtube: add support for youtubeVideoContainer
This commit is contained in:
parent
eb249a3eed
commit
33c801f66b
@ -112,7 +112,8 @@ export default async function({ host, patternMatch, params, isSession, isApiKey
|
|||||||
dispatcher,
|
dispatcher,
|
||||||
id: patternMatch.id.slice(0, 11),
|
id: patternMatch.id.slice(0, 11),
|
||||||
quality: params.videoQuality,
|
quality: params.videoQuality,
|
||||||
format: params.youtubeVideoCodec,
|
codec: params.youtubeVideoCodec,
|
||||||
|
container: params.youtubeVideoContainer,
|
||||||
isAudioOnly,
|
isAudioOnly,
|
||||||
isAudioMuted,
|
isAudioMuted,
|
||||||
dubLang: params.youtubeDubLang,
|
dubLang: params.youtubeDubLang,
|
||||||
@ -122,7 +123,7 @@ export default async function({ host, patternMatch, params, isSession, isApiKey
|
|||||||
|
|
||||||
if (url.hostname === "music.youtube.com" || isAudioOnly) {
|
if (url.hostname === "music.youtube.com" || isAudioOnly) {
|
||||||
fetchInfo.quality = "1080";
|
fetchInfo.quality = "1080";
|
||||||
fetchInfo.format = "vp9";
|
fetchInfo.codec = "vp9";
|
||||||
fetchInfo.isAudioOnly = true;
|
fetchInfo.isAudioOnly = true;
|
||||||
fetchInfo.isAudioMuted = false;
|
fetchInfo.isAudioMuted = false;
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ export default async function (o) {
|
|||||||
let innertubeClient = o.innertubeClient || env.customInnertubeClient || "IOS";
|
let innertubeClient = o.innertubeClient || env.customInnertubeClient || "IOS";
|
||||||
|
|
||||||
// HLS playlists from the iOS client don't contain the av1 video format.
|
// 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;
|
useHLS = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,8 +188,8 @@ export default async function (o) {
|
|||||||
!useHLS
|
!useHLS
|
||||||
&& innertubeClient === "IOS"
|
&& innertubeClient === "IOS"
|
||||||
&& (
|
&& (
|
||||||
(quality > 1080 && o.format !== "h264")
|
(quality > 1080 && o.codec !== "h264")
|
||||||
|| (quality > 1080 && o.format !== "vp9")
|
|| (quality > 1080 && o.codec !== "vp9")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -301,7 +301,7 @@ export default async function (o) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let video, audio, subtitles, dubbedLanguage,
|
let video, audio, subtitles, dubbedLanguage,
|
||||||
codec = o.format || "h264", itag = o.itag;
|
codec = o.codec || "h264", itag = o.itag;
|
||||||
|
|
||||||
if (useHLS) {
|
if (useHLS) {
|
||||||
const variants = await getHlsVariants(
|
const variants = await getHlsVariants(
|
||||||
@ -545,7 +545,7 @@ export default async function (o) {
|
|||||||
if (useHLS) {
|
if (useHLS) {
|
||||||
resolution = normalizeQuality(video.resolution);
|
resolution = normalizeQuality(video.resolution);
|
||||||
filenameAttributes.resolution = `${video.resolution.width}x${video.resolution.height}`;
|
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;
|
video = video.uri;
|
||||||
audio = audio.uri;
|
audio = audio.uri;
|
||||||
@ -556,7 +556,7 @@ export default async function (o) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
filenameAttributes.resolution = `${video.width}x${video.height}`;
|
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) {
|
if (!clientsWithNoCipher.includes(innertubeClient) && innertube) {
|
||||||
video = video.decipher(innertube.session.player);
|
video = video.decipher(innertube.session.player);
|
||||||
|
Loading…
Reference in New Issue
Block a user