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:
Benjamin Kyd
2018-12-31 18:24:25 +00:00
parent 71cd734734
commit ea3e3534fe
11 changed files with 1 additions and 1 deletions

View File

@@ -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'];