Skip to content

Commit

Permalink
fix: '-' symbol in video id workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
talmobi committed Aug 20, 2024
1 parent 10bf461 commit 507abde
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down

0 comments on commit 507abde

Please sign in to comment.