działaj ty kurwo

This commit is contained in:
Patryk Koreń
2026-05-12 20:02:35 +02:00
parent e9cd9ffb91
commit 2eb8d25a2d

View File

@@ -24,7 +24,7 @@ function isYTLink(url: string) {
} }
export async function extractId(url: string): Promise<string> { export async function extractId(url: string): Promise<string> {
if (!isYTLink(url)) { // if (!isYTLink(url)) {
const ytDlpBin = process.env.YT_DLP_BIN_PATH! ?? "yt-dlp"; const ytDlpBin = process.env.YT_DLP_BIN_PATH! ?? "yt-dlp";
return await new Promise<string>((resolve, reject) => { return await new Promise<string>((resolve, reject) => {
const p = spawn(ytDlpBin, [ const p = spawn(ytDlpBin, [
@@ -38,12 +38,12 @@ export async function extractId(url: string): Promise<string> {
p.on("close", code => code === 0 ? resolve(out.trim()) : reject(new Error("yt-dlp extract id failed"))); p.on("close", code => code === 0 ? resolve(out.trim()) : reject(new Error("yt-dlp extract id failed")));
}); });
} else { // } else {
const idMatch = /[?&]v=([a-zA-Z0-9_-]{11})/.exec(url); // const idMatch = /[?&]v=([a-zA-Z0-9_-]{11})/.exec(url);
if (!idMatch) throw new Error("Cannot extract video ID"); // if (!idMatch) throw new Error("Cannot extract video ID");
const id = idMatch[1]; // const id = idMatch[1];
return id // return id
} // }
} }
export async function downloadAudio(url: string): Promise<void> { export async function downloadAudio(url: string): Promise<void> {