From 9f36097598d1cd1df65c0e4ac53ea46651e5365a Mon Sep 17 00:00:00 2001 From: 0d0 <0d0acre@esiliati.org> Date: Tue, 22 Apr 2025 23:54:19 +0200 Subject: [PATCH] Dumb update --- src/lib/server/ytdlp.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lib/server/ytdlp.ts b/src/lib/server/ytdlp.ts index 173c9bf..9e358a3 100644 --- a/src/lib/server/ytdlp.ts +++ b/src/lib/server/ytdlp.ts @@ -1,7 +1,6 @@ -import { create } from 'youtube-dl-exec'; +import { create, type Flags } from 'youtube-dl-exec'; import { env } from '$env/dynamic/private'; import { spawn } from 'node:child_process'; -import supportedFormats from '$lib/common/supportedFormats.json'; import { logger, mimeTypeMap } from '$lib/server/helpers'; const YTDLP_PATH: string = env.YTDLP_PATH as string; @@ -13,7 +12,7 @@ export const ytdl = create(YTDLP_PATH); * Fetch YouTube metadata (title, uploader/artist) */ export async function getYouTubeMetadata(link: string) { - const options = { + const options: Flags = { dumpSingleJson: true, noCheckCertificates: true, noWarnings: true, @@ -66,10 +65,13 @@ export function streamYouTube(link: string, format: string): ReadableStream { try { controller.enqueue(chunk); - } catch (ex) { + } catch () { process.kill(); } }); + + + process.stderr.on('data', (chunk) => logger.debug(chunk.toString())); process.stdout.on('end', () => { try {