Hotfix replacing / charicters in a video string with a - to prevent crashes caused because it would try and download it to a folder
This commit is contained in:
BIN
The Story Of The Cure - Much More Music - Part 2-10.mp4
Normal file
BIN
The Story Of The Cure - Much More Music - Part 2-10.mp4
Normal file
Binary file not shown.
@@ -38,7 +38,7 @@ module.exports.downloadVideos = async (arr, socket, options) => {
|
|||||||
if (ytdl.validateURL(key)) {
|
if (ytdl.validateURL(key)) {
|
||||||
try {
|
try {
|
||||||
const stream = await ytdl(key, {quality: 'highest', filter: (format) => format.container === 'mp4'});
|
const stream = await ytdl(key, {quality: 'highest', filter: (format) => format.container === 'mp4'});
|
||||||
stream.pipe(fs.createWriteStream(`${path}/${value.title}.mp4`));
|
stream.pipe(fs.createWriteStream(`${path}/${(value.title).replace(/\//, '-')}.mp4`));
|
||||||
|
|
||||||
stream.on('response', (res) => {
|
stream.on('response', (res) => {
|
||||||
let totalSize = res.headers['content-length'];
|
let totalSize = res.headers['content-length'];
|
||||||
|
|||||||
Reference in New Issue
Block a user