From 507abde5f5f9708ccec3b6871297f15d39dbbdc5 Mon Sep 17 00:00:00 2001 From: talmobi Date: Tue, 20 Aug 2024 11:37:18 +0300 Subject: [PATCH] fix: '-' symbol in video id workaround --- src/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index fa076c0..5d29567 100644 --- a/src/index.js +++ b/src/index.js @@ -1071,9 +1071,17 @@ function _parseVideoInitialData ( responseText, callback ) // id of the video and finding the same id in the video results -- // genre/category information seems to be lost completely if (!video.description || !video.timestamp || !video.seconds || !video.views) { + debug('in video metadata backup to fill in missing data') + let q = `${video.videoId}` + + debug( 'q (before): ' + q ) + // remove characters that mess up normal behaviour from id for searching + while (q && q[0].match(/[-]/)) q = q.slice(1) + debug( 'q (after) : ' + q ) + setTimeout(function () { search( { - query: `"${video.videoId}"`, + query: q, options: { RETRY_INTERVAL: 1000 },