mirror of
https://github.com/wukko/cobalt.git
synced 2025-04-29 22:14:26 +02:00
api: add an option to allow better audio from youtube
& an env variable to disable it if needed
This commit is contained in:
parent
0294bbd447
commit
335cd51eb5
@ -61,6 +61,7 @@ const env = {
|
|||||||
ytSessionServer: process.env.YOUTUBE_SESSION_SERVER,
|
ytSessionServer: process.env.YOUTUBE_SESSION_SERVER,
|
||||||
ytSessionReloadInterval: 300,
|
ytSessionReloadInterval: 300,
|
||||||
ytSessionInnertubeClient: process.env.YOUTUBE_SESSION_INNERTUBE_CLIENT,
|
ytSessionInnertubeClient: process.env.YOUTUBE_SESSION_INNERTUBE_CLIENT,
|
||||||
|
ytAllowBetterAudio: process.env.YOUTUBE_ALLOW_BETTER_AUDIO !== "0",
|
||||||
}
|
}
|
||||||
|
|
||||||
const genericUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36";
|
const genericUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36";
|
||||||
|
@ -113,6 +113,10 @@ export default async function({ host, patternMatch, params }) {
|
|||||||
fetchInfo.format = "vp9";
|
fetchInfo.format = "vp9";
|
||||||
fetchInfo.isAudioOnly = true;
|
fetchInfo.isAudioOnly = true;
|
||||||
fetchInfo.isAudioMuted = false;
|
fetchInfo.isAudioMuted = false;
|
||||||
|
|
||||||
|
if (env.ytAllowBetterAudio && params.youtubeBetterAudio) {
|
||||||
|
fetchInfo.quality = "max";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
r = await youtube(fetchInfo);
|
r = await youtube(fetchInfo);
|
||||||
|
@ -46,5 +46,6 @@ export const apiSchema = z.object({
|
|||||||
localProcessing: z.boolean().default(false),
|
localProcessing: z.boolean().default(false),
|
||||||
|
|
||||||
youtubeHLS: z.boolean().default(false),
|
youtubeHLS: z.boolean().default(false),
|
||||||
|
youtubeBetterAudio: z.boolean().default(false),
|
||||||
})
|
})
|
||||||
.strict();
|
.strict();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user