diff --git a/controller/websocket.js b/controller/websocket.js index 33e5b66..4674c4c 100644 --- a/controller/websocket.js +++ b/controller/websocket.js @@ -57,7 +57,7 @@ exports.save = async (ws, req) => { if (msg == 'alive') return if (await redis.get(id) != 'downloading') { - await redis.set(id, 'downloading') + await redis.set(id, 'downloading', 'EX', 300) const confirm = await captcha.checkCaptcha(msg) if (confirm) startDownloading() @@ -168,7 +168,7 @@ exports.playlist = async (ws, req) => { } ws.send(`INFO - Downloading ${video.title}

`) - await redis.set(id, 'downloading') + await redis.set(id, 'downloading', 'EX', 300) const download = await ytdlp.downloadVideo('https://www.youtube.com' + video.url, ws, id) if (download.fail) { @@ -264,7 +264,7 @@ exports.channel = async (ws, req) => { } ws.send(`INFO - Downloading ${video.title.text}

`) - await redis.set(video.id, 'downloading') + await redis.set(video.id, 'downloading', 'EX', 300) const download = await ytdlp.downloadVideo(`https://www.youtube.com/watch?v=${video.id}`, ws, video.id) if (download.fail) { diff --git a/utils/ytdlp.js b/utils/ytdlp.js index 44c9d9b..4a620e0 100644 --- a/utils/ytdlp.js +++ b/utils/ytdlp.js @@ -18,7 +18,7 @@ async function downloadVideo(url, ws, id) { const downloadJson = await metadata.getVideoDownload(url, quality) if (downloadJson.status == 'error') { return resolve({ - message: 'Failed to request Youtube. Please retry...', + message: `Failed to request Youtube with error ${downloadJson.text}. Please retry...`, fail: true }) }