diff --git a/config_example.json b/config_example.json index 56bcd07..8c359ca 100644 --- a/config_example.json +++ b/config_example.json @@ -5,6 +5,7 @@ "domain": "f0ck.dev", "regex": "f0ck\\.dev" }, + "socks": "", "maxfilesize": 83886080, "adminmultiplier": 3.5, "ignored": [ diff --git a/src/inc/trigger/parser.mjs b/src/inc/trigger/parser.mjs index 10d22c2..e81be20 100644 --- a/src/inc/trigger/parser.mjs +++ b/src/inc/trigger/parser.mjs @@ -73,7 +73,7 @@ export default async bot => { // is instagram try { // @flummi -> is there a variable for the actual work directory so it doesn't have to be hardcoded? - const meta = JSON.parse((await queue.exec(`yt-dlp -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' --skip-download --dump-json "${link}"`)).stdout); + const meta = JSON.parse((await queue.exec(`yt-dlp ${cfg.main.socks} -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' --skip-download --dump-json "${link}"`)).stdout); ext = meta.ext; } catch(err) { const tmphead = (await fetch(link, { method: "HEAD" })).headers["content-type"]; @@ -88,7 +88,7 @@ export default async bot => { else { // is not instagram try { - const meta = JSON.parse((await queue.exec(`yt-dlp -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' --skip-download --dump-json "${link}"`)).stdout); + const meta = JSON.parse((await queue.exec(`yt-dlp ${cfg.main.socks} -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' --skip-download --dump-json "${link}"`)).stdout); ext = meta.ext; } catch(err) { const tmphead = (await fetch(link, { method: "HEAD" })).headers["content-type"]; @@ -112,7 +112,7 @@ export default async bot => { if(link.match(regex.instagram)) { try { // add --cookies on local instance if you want to avoid getting rate limited - source = (await queue.exec(`yt-dlp -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' "${link}" --max-filesize ${maxfilesize / 1024}k --postprocessor-args "ffmpeg:-bitexact" -o "./tmp/${uuid}.%(ext)s" --print after_move:filepath --merge-output-format "mp4"`)).stdout.trim(); + source = (await queue.exec(`yt-dlp ${cfg.main.socks} -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' "${link}" --max-filesize ${maxfilesize / 1024}k --postprocessor-args "ffmpeg:-bitexact" -o "./tmp/${uuid}.%(ext)s" --print after_move:filepath --merge-output-format "mp4"`)).stdout.trim(); } catch(err) { if(e.type == 'tg') return await e.editMessageText(msg.result.chat.id, msg.result.message_id, "instagram dl error"); @@ -133,7 +133,7 @@ export default async bot => { } else { try { - source = (await queue.exec(`yt-dlp -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' "${link}" --max-filesize ${maxfilesize / 1024}k --postprocessor-args "ffmpeg:-bitexact" -o "./tmp/${uuid}.%(ext)s" --print after_move:filepath --merge-output-format "mp4"`)).stdout.trim(); + source = (await queue.exec(`yt-dlp ${cfg.main.socks} -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' "${link}" --max-filesize ${maxfilesize / 1024}k --postprocessor-args "ffmpeg:-bitexact" -o "./tmp/${uuid}.%(ext)s" --print after_move:filepath --merge-output-format "mp4"`)).stdout.trim(); } catch(err) { console.error('err:', err); if(e.type == 'tg')