node-ytdl-core: Unable to retrieve video metadata

Stack trace:

Error: Error parsing info: Unable to retrieve video metadata
    at getWatchPage (/home/csanad/SektorMusicEris/node_modules/ytdl-core/lib/info.js:77:13)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async exports.getBasicInfo (/home/csanad/SektorMusicEris/node_modules/ytdl-core/lib/info.js:86:22)
    at async Map.getOrSet (/home/csanad/SektorMusicEris/node_modules/ytdl-core/lib/cache.js:24:19)
    at async exports.getInfo (/home/csanad/SektorMusicEris/node_modules/ytdl-core/lib/info.js:210:14)
    at async Map.getOrSet (/home/csanad/SektorMusicEris/node_modules/ytdl-core/lib/cache.js:24:19)

Code snippet:

serverQueue.connection.play(ytdl(song.url, {
            filter: "audioonly",
            quality: "highestaudio"
        })

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 10
  • Comments: 50 (3 by maintainers)

Commits related to this issue

Most upvoted comments

I think i fixed the issue. I was accidentally using ytdl-core-discord instead of ytdl-core as well. Make sure you are using the correct package. ytdl-core-discord is using ytdl-core but is more unstable. So, here’s my solution path:

npm rm ytdl-core-discord
npm i ytdl-core@latest

Eventually you’ll have to fix parts of your code too. (I had to fix some stuff with opus) Hope this helps.

I’m still getting this issue. I have tried everything at this point.

  • I have tried @JasperSurmont 's idea of allowing the failure instance to try again and again up to a certain limit and it doesn’t work.
  • I have tried @GabFLAB 's way of musicPlayer.songUrl.push(v.url || v.videoId) and this still doesn’t work.
  • I have tried a completely fresh install of all my deps as @JerryFunHouse did and it still doesn’t work
  • And finally, as @amitojsingh366 had luck with updating his ytdl-core, I tried that as well and it still doesn’t work. I also tried rolling back to 4.0.3 since currently it’s 4.0.4 and this still didn’t work.

At this point, I’m just pissed off after working on this issue for over 5 hours and it still refuses to work. Does anyone have a guaranteed solution or just straight up; some other node.js library I can use instead of ytdl-core?

Rolled back to 4.0.3 to fix issue. Works fine for now. (discord.js + ytdl-core). Are you sure that you rollbacked correctly?

npm uninstall ytdl-core
npm install ytdl-core@4.0.3

I wish you find a great fix for yourself

Heyo guys!

I think I found some solution, which is simply updating dependencies. I used ‘npm uninstall discord.js opusscript ytdl-core’ then did ‘npm install discord.js opusscript ytdl-core’ and now my bot seems to work fine again - lets hope this will last long…

Apparently, ytdl-core went from v4.0.0 to v4.0.3 to even v4.1.0. Meanwhile, discord.js went from v12.4.1 to v12.5.1 for me. Opusscript remained v0.0.7 after all. Updated opusscript nonetheless because it’s part of the entire thing.

Heyo guys!

I think I found some solution, which is simply updating dependencies. I used ‘npm uninstall discord.js opusscript ytdl-core’ then did ‘npm install discord.js opusscript ytdl-core’ and now my bot seems to work fine again - lets hope this will last long…

Apparently, ytdl-core went from v4.0.0 to v4.0.3 to even v4.1.0. Meanwhile, discord.js went from v12.4.1 to v12.5.1 for me. Opusscript remained v0.0.7 after all. Updated opusscript nonetheless because it’s part of the entire thing.

This method worked perfectly for me.

Hi I have been doing this since yesterday afternoon, has anyone managed to fix this? When I run my bot via visual studio code I don’t have this problem, but if I do it via my host I have it

Error : Error: Error parsing info: Unable to retrieve video metadata at getWatchPage (/home/north/node_modules/ytdl-core-discord/node_modules/ytdl-core/lib/info.js:75:13)

your stack trace shows ytdl-core-discord using their own version of ytdl-core