From 12a757a954cf9d51e2dd81df883aae6f34de1f62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Sat, 26 Sep 2020 13:20:25 +0200 Subject: [PATCH 1/2] Fix download of video ids which start with - --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index 7fdbf84..1904c53 100644 --- a/index.js +++ b/index.js @@ -36,6 +36,7 @@ function downloadYoutube(id, response) { let args = [ "-f", "bestaudio", "-o", `${__dirname}/_youtube/%(title)s-%(id)s.%(ext)s`, + "--", id ] let child = require("child_process").spawn(cmd, args); From 547c6fc17b7032d39ee6059ce5aea26efafd47cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Sat, 26 Sep 2020 13:20:49 +0200 Subject: [PATCH 2/2] Fix bash on NixOS Not all systems have their bash under bin. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 1904c53..75eb45c 100644 --- a/index.js +++ b/index.js @@ -17,7 +17,7 @@ function searchYoutube(q, limit, response) { q = escape(`ytsearch${limit}:${q}`); const command = `set -o pipefail; ${cmd} -j ${q} | jq "{id,title}" | jq -s .`; - require("child_process").exec(command, {shell:"/bin/bash"}, (error, stdout, stderr) => { + require("child_process").exec(command, {shell:"bash"}, (error, stdout, stderr) => { if (error) { console.log("error", error); response.writeHead(500);