From 2eb8d25a2d657c730bb82b4c48824cc703633316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Kore=C5=84?= Date: Tue, 12 May 2026 20:02:35 +0200 Subject: [PATCH] =?UTF-8?q?dzia=C5=82aj=20ty=20kurwo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/util/downloader.ts | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/util/downloader.ts b/src/util/downloader.ts index 698a6cb..fe52669 100644 --- a/src/util/downloader.ts +++ b/src/util/downloader.ts @@ -20,30 +20,30 @@ export async function getAudioFile(url: string): Promise { function isYTLink(url: string) { return url.startsWith("https://youtube") || - url.startsWith("https://youtu.be"); + url.startsWith("https://youtu.be"); } export async function extractId(url: string): Promise { - if (!isYTLink(url)) { - const ytDlpBin = process.env.YT_DLP_BIN_PATH! ?? "yt-dlp"; - return await new Promise((resolve, reject) => { - const p = spawn(ytDlpBin, [ - "--print", "%(id)s", - url, - ]); + // if (!isYTLink(url)) { + const ytDlpBin = process.env.YT_DLP_BIN_PATH! ?? "yt-dlp"; + return await new Promise((resolve, reject) => { + const p = spawn(ytDlpBin, [ + "--print", "%(id)s", + url, + ]); - let out = "" - p.stderr.on("data", d => process.stderr.write(d)); - p.stdout.on("data", d => out += d.toString()); - p.on("close", code => code === 0 ? resolve(out.trim()) : reject(new Error("yt-dlp extract id failed"))); - }); + let out = "" + p.stderr.on("data", d => process.stderr.write(d)); + p.stdout.on("data", d => out += d.toString()); + p.on("close", code => code === 0 ? resolve(out.trim()) : reject(new Error("yt-dlp extract id failed"))); + }); - } else { - const idMatch = /[?&]v=([a-zA-Z0-9_-]{11})/.exec(url); - if (!idMatch) throw new Error("Cannot extract video ID"); - const id = idMatch[1]; - return id - } + // } else { + // const idMatch = /[?&]v=([a-zA-Z0-9_-]{11})/.exec(url); + // if (!idMatch) throw new Error("Cannot extract video ID"); + // const id = idMatch[1]; + // return id + // } } export async function downloadAudio(url: string): Promise {