diff --git a/src/download.js b/src/download.js index ec6e190..52db0bc 100644 --- a/src/download.js +++ b/src/download.js @@ -7,7 +7,7 @@ function calcPercents(current, max) { return ((current / max) * 100).toFixed(1); } -export default async function downloadFile(url, outputPath, subtask, videoId) { +export default async function downloadFile(url, outputPath, subtask, videoId, proxyData) { if (!url) { throw new Error("Invalid download link"); } @@ -17,6 +17,7 @@ export default async function downloadFile(url, outputPath, subtask, videoId) { method: "get", url: url, responseType: "stream", + proxy: proxyData || false, }); const totalLength = headers["content-length"]; diff --git a/src/index.js b/src/index.js index e963619..53f8fc3 100644 --- a/src/index.js +++ b/src/index.js @@ -358,6 +358,7 @@ async function main() { `${OUTPUT_DIR}/${filename}`, subtask, `(ID: ${videoId} as ${filename})`, + proxyData, ) .then(() => { subtask.title = `Download ${taskSubTitle} completed!`; @@ -411,6 +412,7 @@ async function main() { `${OUTPUT_DIR}/${filename}`, subtask, `(ID: ${videoId} as ${filename})`, + proxyData, ) .then(() => { subtask.title = `Download ${taskSubTitle} completed!`;