diff --git a/.env.example b/.env.example index e7fa9d0..f069167 100644 --- a/.env.example +++ b/.env.example @@ -2,3 +2,4 @@ HOST=0.0.0.0 ORIGIN=https://dl.emersa.it YTDLP_PATH=./yt-dlp PUBLIC_VERSION=0.6.3 +HTTPS_PROXY= \ No newline at end of file diff --git a/src/lib/server/ytdlp.ts b/src/lib/server/ytdlp.ts index 0ff15fa..0ede591 100644 --- a/src/lib/server/ytdlp.ts +++ b/src/lib/server/ytdlp.ts @@ -5,6 +5,7 @@ import supportedFormats from '$lib/common/supportedFormats.json'; import { logger, mimeTypeMap } from '$lib/server/helpers'; const YTDLP_PATH: string = env.YTDLP_PATH as string; +const HTTPS_PROXY: string = env.v as string; export const ytdl = create(YTDLP_PATH); @@ -16,7 +17,8 @@ export async function getYouTubeMetadata(link: string) { dumpSingleJson: true, noCheckCertificates: true, noWarnings: true, - preferFreeFormats: true + preferFreeFormats: true, + proxy: HTTPS_PROXY ? HTTPS_PROXY : '' }); } @@ -34,7 +36,12 @@ export function streamYouTube(link: string, format: string): ReadableStream