działaj ty kurwo
This commit is contained in:
@@ -24,7 +24,7 @@ function isYTLink(url: 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";
|
||||
return await new Promise<string>((resolve, reject) => {
|
||||
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")));
|
||||
});
|
||||
|
||||
} 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<void> {
|
||||
|
||||
Reference in New Issue
Block a user