Merge pull request #20 from SuperSandro2000/master

Fix bash location on nixOS, fix download ids start with -
This commit is contained in:
Ondřej Žára 2020-09-26 14:07:16 +02:00 committed by GitHub
commit c04b8f633b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,7 +17,7 @@ function searchYoutube(q, limit, response) {
q = escape(`ytsearch${limit}:${q}`); q = escape(`ytsearch${limit}:${q}`);
const command = `set -o pipefail; ${cmd} -j ${q} | jq "{id,title}" | jq -s .`; 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) { if (error) {
console.log("error", error); console.log("error", error);
response.writeHead(500); response.writeHead(500);
@ -36,6 +36,7 @@ function downloadYoutube(id, response) {
let args = [ let args = [
"-f", "bestaudio", "-f", "bestaudio",
"-o", `${__dirname}/_youtube/%(title)s-%(id)s.%(ext)s`, "-o", `${__dirname}/_youtube/%(title)s-%(id)s.%(ext)s`,
"--",
id id
] ]
let child = require("child_process").spawn(cmd, args); let child = require("child_process").spawn(cmd, args);