From 0161f544aa05b2a5eeee658e57e9a37da68d7362 Mon Sep 17 00:00:00 2001 From: Tzahi12345 Date: Tue, 3 Jan 2023 01:50:56 -0500 Subject: [PATCH] Fixed issue where sometimes only the first video from a playlist would be registered --- backend/downloader.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/downloader.js b/backend/downloader.js index 0aff889..07d1857 100644 --- a/backend/downloader.js +++ b/backend/downloader.js @@ -290,7 +290,10 @@ async function downloadQueuedFile(download_uid) { for (let i = 0; i < output.length; i++) { let output_json = null; try { - output_json = JSON.parse(output[i]); + // we have to do this because sometimes there will be leading characters before the actual json + const start_idx = output[i].indexOf('{"'); + const clean_output = output[i].slice(start_idx, output[i].length); + output_json = JSON.parse(clean_output); } catch(e) { output_json = null; }