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"
})
Hello, I am having this issue as well
Same problem, seems to be happening very randomly.
Sometimes a certain video throws this error, and sometimes that same video works. I'd say I encounter it in about 1/10 songs.
I confirm I'm experiencing the same issue... At a more frequent rate tho, like 1 every 3 videos.
I am having this issue as well
Happens aswell for me, tried updating to latest with same results
yup im getting the same issue for me its happening randomly aswell.
@fent Instead of throwing an error we need to fallback to old extraction method (from watch page) to fix this issue. That method is more consistent with results.
New error trace:
TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received undefined
at validateString (internal/validators.js:120:11)
at Url.parse (url.js:159:3)
at urlParse (url.js:154:13)
at Url.resolve (url.js:667:29)
at Object.urlResolve [as resolve] (url.js:663:40)
at exports.getInfo (/home/csanad/SektorMusicEris/node_modules/ytdl-core/lib/info.js:218:32)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Map.getOrSet (/home/csanad/SektorMusicEris/node_modules/ytdl-core/lib/cache.js:24:19) {
code: 'ERR_INVALID_ARG_TYPE'
}
Yup get the same issue maybe 1/15 songs. but it is there.
Same here, I set up a repair instance to retry to play the video, works well.
yup same here any fixes yet?
yup same here any fixes yet?
Try to create a repair instance that try to ytdl() the video again and again, works perfectly.
yup same here any fixes yet?
Try to create a repair instance that try to ytdl() the video again and again, works perfectly.
Well thing is im not even getting a video its just a song, but I guess that doesn't really matter. What does yours look like?
@JerryFunHouse For example in my discord bot I just repeat it 5 times and if it's still an error just skip it (to prevent infinite loops):
function play(connection, bot, message, repeated) {
// Play song here with ytdl, then catch error
dispatcher.on('error', (err) => {
repeated = repeated || 0;
if (repeated === 4) {
bot.commands.get('skip').execute(message, []);
}
else play(connection, message, bot, ++repeated);
console.log(err);
});
@JerryFunHouse For example in my discord bot I just repeat it 5 times and if it's still an error just skip it (to prevent infinite loops):
function play(connection, bot, message, repeated) { // Play song here with ytdl, then catch error dispatcher.on('error', (err) => { repeated = repeated || 0; if (repeated === 4) { bot.commands.get('skip').execute(message, []); } else play(connection, message, bot, ++repeated); console.log(err); });
Perfect, I updated my bot to send the videoId, but if its value === undefined I send the videoUrl, ;) the repair instance was never activated since that.
@JerryFunHouse For example in my discord bot I just repeat it 5 times and if it's still an error just skip it (to prevent infinite loops):
function play(connection, bot, message, repeated) { // Play song here with ytdl, then catch error dispatcher.on('error', (err) => { repeated = repeated || 0; if (repeated === 4) { bot.commands.get('skip').execute(message, []); } else play(connection, message, bot, ++repeated); console.log(err); });Perfect, I updated my bot to send the videoId, but if its value === undefined I send the videoUrl, ;) the repair instance was never activated since that.
Sounds cool but I've never done anything with that dispatcher stuff before so maybe you could show me what you mean? I dont really know what you mean with videoOld
@JerryFunHouse The dispatcher is a StreamDispatcher, which is something Discord related. If you're not using discord.js, you should still be able to catch errors with whatever service you're using to play the ytdl stream.
@JerryFunHouse The dispatcher is a StreamDispatcher, which is something Discord related. If you're not using discord.js, you should still be able to catch errors with whatever service you're using to play the ytdl stream.
I know its Discord related I've just never really worked with it and yes I am catching all the errors but @GabFLAB seems to have a fix that I don't really understand.
@JerryFunHouse The dispatcher is a StreamDispatcher, which is something Discord related. If you're not using discord.js, you should still be able to catch errors with whatever service you're using to play the ytdl stream.
I know its Discord related I've just never really worked with it and yes I am catching all the errors but @GabFLAB seems to have a fix that I don't really understand.
If your bot uses yt-search or something like that, try to get the video id, so if the url of the video is undefined you just send the video id, just like that: musicPlayer.songUrl.push(v.url || v.videoId). This will avoid infinite errors.
let readable = await ytdl(musicPlayer.songUrl[0], {quality: "highestaudio, highWaterMark: 1<<25});
musicPlayer.dispatcher = musicPlayer.connection.play(readable, { highWaterMark: 96, bitrate: 96, fec: true, volume: false });
Note: It's important to use FEC, this will save your life.
the most important is the musicPlayer.songUrl.push(v.url || v.videoId).
Seems to be fixed by now, try to update the package.
@JerryFunHouse The dispatcher is a StreamDispatcher, which is something Discord related. If you're not using discord.js, you should still be able to catch errors with whatever service you're using to play the ytdl stream.
I know its Discord related I've just never really worked with it and yes I am catching all the errors but @GabFLAB seems to have a fix that I don't really understand.
If your bot uses yt-search or something like that, try to get the video id, so if the url of the video is undefined you just send the video id, just like that: musicPlayer.songUrl.push(v.url || v.videoId). This will avoid infinite errors.
let readable = await ytdl(musicPlayer.songUrl[0], {quality: "highestaudio, highWaterMark: 1<<25});
musicPlayer.dispatcher = musicPlayer.connection.play(readable, { highWaterMark: 96, bitrate: 96, fec: true, volume: false });
Note: It's important to use FEC, this will save your life.
the most important is the musicPlayer.songUrl.push(v.url || v.videoId).
Seems to be fixed by now, try to update the package.
Hm updated it but it doesnt seem to be fixed for me I use ytdl-core. I'll try your method thanks! And what's FEC? I'm still kind of a rookie sorry.
Edit: I just noticed it didnt know the newest version is 4.0.3 which means mine didnt update to the latest version. Ill reinstall ytdl-core and retry
@JerryFunHouse The dispatcher is a StreamDispatcher, which is something Discord related. If you're not using discord.js, you should still be able to catch errors with whatever service you're using to play the ytdl stream.
I know its Discord related I've just never really worked with it and yes I am catching all the errors but @GabFLAB seems to have a fix that I don't really understand.
If your bot uses yt-search or something like that, try to get the video id, so if the url of the video is undefined you just send the video id, just like that: musicPlayer.songUrl.push(v.url || v.videoId). This will avoid infinite errors.
let readable = await ytdl(musicPlayer.songUrl[0], {quality: "highestaudio, highWaterMark: 1<<25});
musicPlayer.dispatcher = musicPlayer.connection.play(readable, { highWaterMark: 96, bitrate: 96, fec: true, volume: false });
Note: It's important to use FEC, this will save your life.
the most important is the musicPlayer.songUrl.push(v.url || v.videoId).
Seems to be fixed by now, try to update the package.Hm updated it but it doesnt seem to be fixed for me I use ytdl-core. I'll try your method thanks! And what's FEC? I'm still kind of a rookie sorry.
Edit: I just noticed it didnt know the newest version is 4.0.3 which means mine didnt update to the latest version. Ill reinstall ytdl-core and retry
Just updated to 4.0.3 and I get this error when starting my bot.
2020-11-04T11:42:37.242967+00:00 app[worker.1]: internal/modules/cjs/loader.js:834
2020-11-04T11:42:37.242990+00:00 app[worker.1]: throw err;
2020-11-04T11:42:37.242990+00:00 app[worker.1]: ^
2020-11-04T11:42:37.242990+00:00 app[worker.1]:
2020-11-04T11:42:37.242991+00:00 app[worker.1]: Error: Cannot find module './utils'
2020-11-04T11:42:37.242991+00:00 app[worker.1]: Require stack:
2020-11-04T11:42:37.242992+00:00 app[worker.1]: - /app/node_modules/ytdl-core/lib/info.js
2020-11-04T11:42:37.242992+00:00 app[worker.1]: - /app/node_modules/ytdl-core/lib/index.js
2020-11-04T11:42:37.242992+00:00 app[worker.1]: - /app/index.js
2020-11-04T11:42:37.242993+00:00 app[worker.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)
2020-11-04T11:42:37.242993+00:00 app[worker.1]: at Function.Module._load (internal/modules/cjs/loader.js:687:27)
2020-11-04T11:42:37.242994+00:00 app[worker.1]: at Module.require (internal/modules/cjs/loader.js:903:19)
2020-11-04T11:42:37.242994+00:00 app[worker.1]: at require (internal/modules/cjs/helpers.js:74:18)
2020-11-04T11:42:37.242995+00:00 app[worker.1]: at Object.<anonymous> (/app/node_modules/ytdl-core/lib/info.js:5:15)
2020-11-04T11:42:37.242995+00:00 app[worker.1]: at Module._compile (internal/modules/cjs/loader.js:1015:30)
2020-11-04T11:42:37.242995+00:00 app[worker.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
2020-11-04T11:42:37.242996+00:00 app[worker.1]: at Module.load (internal/modules/cjs/loader.js:879:32)
2020-11-04T11:42:37.242996+00:00 app[worker.1]: at Function.Module._load (internal/modules/cjs/loader.js:724:14)
2020-11-04T11:42:37.242996+00:00 app[worker.1]: at Module.require (internal/modules/cjs/loader.js:903:19) {
2020-11-04T11:42:37.242997+00:00 app[worker.1]: code: 'MODULE_NOT_FOUND',
2020-11-04T11:42:37.242997+00:00 app[worker.1]: requireStack: [
2020-11-04T11:42:37.242997+00:00 app[worker.1]: '/app/node_modules/ytdl-core/lib/info.js',
2020-11-04T11:42:37.242998+00:00 app[worker.1]: '/app/node_modules/ytdl-core/lib/index.js',
2020-11-04T11:42:37.242998+00:00 app[worker.1]: '/app/index.js'
2020-11-04T11:42:37.242998+00:00 app[worker.1]: ]
2020-11-04T11:42:37.242999+00:00 app[worker.1]: }
Ok so I added require("./utils"); to my index.js and now the require Stack only says
Yup updating completely broke my bot, does anyone have any fixes for that error please? Reverting to the old version of ytdl-core didnt help either.
I can't understand this error, try to rewind or something like that.
hmm, the util.js refactoring occured in v4.0.0 here
weird that you're getting that error now with v4.0.3. integration tests show no error too. maybe do a clean install
hmm, the
util.jsrefactoring occured in v4.0.0 hereweird that you're getting that error now with v4.0.3. integration tests show no error too. maybe do a clean install
nope did a clean install of everything, my bot is not starting at all I have no idea what happened
2020-11-04T20:58:59.574824+00:00 app[worker.1]: internal/modules/cjs/loader.js:834
2020-11-04T20:58:59.574839+00:00 app[worker.1]: throw err;
2020-11-04T20:58:59.574840+00:00 app[worker.1]: ^
2020-11-04T20:58:59.574840+00:00 app[worker.1]:
2020-11-04T20:58:59.574840+00:00 app[worker.1]: Error: Cannot find module './utils'
2020-11-04T20:58:59.574840+00:00 app[worker.1]: Require stack:
2020-11-04T20:58:59.574840+00:00 app[worker.1]: - /app/index.js
2020-11-04T20:58:59.574841+00:00 app[worker.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)
2020-11-04T20:58:59.574841+00:00 app[worker.1]: at Function.Module._load (internal/modules/cjs/loader.js:687:27)
2020-11-04T20:58:59.574842+00:00 app[worker.1]: at Module.require (internal/modules/cjs/loader.js:903:19)
2020-11-04T20:58:59.574842+00:00 app[worker.1]: at require (internal/modules/cjs/helpers.js:74:18)
2020-11-04T20:58:59.574842+00:00 app[worker.1]: at Object.<anonymous> (/app/index.js:7:1)
2020-11-04T20:58:59.574842+00:00 app[worker.1]: at Module._compile (internal/modules/cjs/loader.js:1015:30)
2020-11-04T20:58:59.574843+00:00 app[worker.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
2020-11-04T20:58:59.574843+00:00 app[worker.1]: at Module.load (internal/modules/cjs/loader.js:879:32)
2020-11-04T20:58:59.574843+00:00 app[worker.1]: at Function.Module._load (internal/modules/cjs/loader.js:724:14)
2020-11-04T20:58:59.574845+00:00 app[worker.1]: at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) {
2020-11-04T20:58:59.574845+00:00 app[worker.1]: code: 'MODULE_NOT_FOUND',
2020-11-04T20:58:59.574845+00:00 app[worker.1]: requireStack: [ '/app/index.js' ]
2020-11-04T20:58:59.574846+00:00 app[worker.1]: }
Did a complete reinstall again but without ytdl-core, and it gave me the same error but with ytdl-core missing, which made sense so I installed ytdl-core again, and it works now. I have no idea why that made a difference but Im happy its working now. Ill update you if the video metadata issue is still present.
Update: Yup i dont seem to get any video metadata errors anymore thanks!
I didn't have this error, then I updated to the new 4.0.3 and now I am getting this error, it only does this on my server though never on my dev computer (my server is a google E2 vps, Dev computer is a windows 10 on "Build 20241.rs_prerelease.201016-1450")
This error was fixed for me on v4.0.3. Just re-check if your E2 vps is using v4.0.3 and not a prior one (check your package.json). Also if you want it to automatically update all deps I wrote a .sh script I wrote that does the job (I run the script using cron).
Here is the script:
sudo npm install -g npm-check-updates
npm install
npm update
I'm still getting this issue. I have tried everything at this point.
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?
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 [email protected]
I wish you find a great fix for yourself
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 [email protected]I wish you find a great fix for yourself
Yep, I did exactly this..
I don't know if its maybe because my other deps are not the right version?
I've got ffmpeg-static and @discord.js/opus and maybe they're not the right version? Or if they even matter for ytdl-core
@Arniox , My dependencies. Try these versions
"dependencies": {
"discord.js": "^12.4.1",
"ffmpeg-static": "^4.2.7",
"opusscript": "0.0.7",
"ytdl-core": "^4.0.3"
}
@Arniox , My dependencies. Try these versions
"dependencies": { "discord.js": "^12.4.1", "ffmpeg-static": "^4.2.7", "opusscript": "0.0.7", "ytdl-core": "^4.0.3" }
I think I finally found it. I have been testing for a while and am no longer getting the same error.
I was missing opusscript it turns out. I was using @discordjs/opus but I think you need both.
This seemed to fix it. Thank you so much
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.
@KRooijackers heyo bro
I'm trying to solve it the way you told me, but it doesn't work. 'npm uninstall discord.js opusscript ytdl-core' then did'npm install discord.js opusscript ytdl-core' error parsing info: unable to retrieve video metadata This error keeps repeating.
@Pasta101358 I'm sorry to hear that :/
I'm unable to help right now, but I could have a quick look via discord later if you want (can send me DM via Github if interested). Try to look for more solutions and narrow possible causes for the issue. I saw some catch error solutions above which could possible already solve your issue.
Anyhow, best of luck on getting your bot to work again <3
Hey , i've been having the same issue.
I tried uninstalling ytdl-core and reinstalling it , along with adding opusscript.
Anyone got anything or is this hopefully gonna be fixed?
This is happening a lot, and once it starts I need to restart the entire bot(host server).
i have same problem
Tried all of the solutions above. Nothing working for me unfortunately...
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)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async exports.getBasicInfo (/home/north/node_modules/ytdl-core-discord/node_modules/ytdl-core/lib/info.js:84:22)
at async Map.getOrSet (/home/north/node_modules/ytdl-core-discord/node_modules/ytdl-core/lib/cache.js:24:19)
at async exports.getInfo (/home/north/node_modules/ytdl-core-discord/node_modules/ytdl-core/lib/info.js:226:14)
at async Map.getOrSet (/home/north/node_modules/ytdl-core-discord/node_modules/ytdl-core/lib/cache.js:24:19)
at async download (/home/north/node_modules/ytdl-core-discord/index.js:26:15)
at async play (/home/north/include/play.js:27:18)
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)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async exports.getBasicInfo (/home/north/node_modules/ytdl-core-discord/node_modules/ytdl-core/lib/info.js:84:22)
at async Map.getOrSet (/home/north/node_modules/ytdl-core-discord/node_modules/ytdl-core/lib/cache.js:24:19)
at async exports.getInfo (/home/north/node_modules/ytdl-core-discord/node_modules/ytdl-core/lib/info.js:226:14)
at async Map.getOrSet (/home/north/node_modules/ytdl-core-discord/node_modules/ytdl-core/lib/cache.js:24:19)
at async download (/home/north/node_modules/ytdl-core-discord/index.js:26:15)
at async play (/home/north/include/play.js:27:18)
What package versions are you using that it's working locally for you?
4.1.2
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
I did not understand where are you coming from?
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.
what I don't understand is that under Debian it doesn't work but under ubuntu everything works fine, suddenly I changed my OS and everything works again.
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" })
I've been getting this on LilNasX Holiday but it didn't before, and now every song too
quality: "highestaudio"
same issue
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.
Most helpful comment
Rolled back to 4.0.3 to fix issue. Works fine for now. (discord.js + ytdl-core). Are you sure that you rollbacked correctly?
I wish you find a great fix for yourself