Add yt-dlp proxy support
This commit is contained in:
parent
a745e28eb9
commit
a68965e8a7
@ -53,6 +53,12 @@ module.exports = {
|
||||
*/
|
||||
ytDlpPath: './yt-dlp',
|
||||
|
||||
/**
|
||||
* Proxy URL to use for yt-dlp
|
||||
* Might be useful in some cases where your usual IP (e.g. shared datacenter IP) is blocked
|
||||
*/
|
||||
ytdlpProxy: null,
|
||||
|
||||
/**
|
||||
* YouTube API key for search
|
||||
*/
|
||||
|
12
index.ts
12
index.ts
@ -62,6 +62,11 @@ const player = createAudioPlayer();
|
||||
const yt = new YouTube(config.youtubeApiKey);
|
||||
const httpClient = axios.create();
|
||||
|
||||
let ytProxy = null as null | string;
|
||||
if (config.ytdlpProxy) {
|
||||
ytProxy = config.ytdlpProxy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bot state
|
||||
*/
|
||||
@ -466,6 +471,13 @@ async function queueUrl(message: Message, words: string[], options: Object | und
|
||||
`${path}.%(ext)s`,
|
||||
];
|
||||
|
||||
if (ytProxy) {
|
||||
ytdlpParams = ytdlpParams.concat([
|
||||
'--proxy',
|
||||
ytProxy,
|
||||
]);
|
||||
}
|
||||
|
||||
if (!fullVideo) {
|
||||
ytdlpParams = ytdlpParams.concat([
|
||||
'--sponsorblock-remove',
|
||||
|
Loading…
Reference in New Issue
Block a user