Calling getInfo with some videos results in the following error:
(node:61290) UnhandledPromiseRejectionWarning: TypeError: secondaryResults is not iterable
at Object.exports.getRelatedVideos (/mnt/data/Code/Node/discord-music-bot/node_modules/ytdl-core/lib/info-extras.js:128:22)
at gotConfig (/mnt/data/Code/Node/discord-music-bot/node_modules/ytdl-core/lib/info.js:151:32)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Object.exports.<computed> [as getBasicInfo] (/mnt/data/Code/Node/discord-music-bot/node_modules/ytdl-core/lib/info.js:298:18)
at async exports.getInfo (/mnt/data/Code/Node/discord-music-bot/node_modules/ytdl-core/lib/info.js:184:14)
at async Function.exports.<computed> [as getInfo] (/mnt/data/Code/Node/discord-music-bot/node_modules/ytdl-core/lib/info.js:298:18)
at async VoiceHandler.addTrack (/mnt/data/Code/Node/discord-music-bot/src/Modules/VoiceHandler.js:20:18)
at async Object.exports.handler (/mnt/data/Code/Node/discord-music-bot/src/Commands/play.js:53:5
It appears #509 mentions a fix for this issue, which appears to be dependent on the mood of the YouTube API. Might be worth merging it or something similar to avoid the issue in the future.
Yeah, I still see it from time to time.
are you using a custom user-agent or proxy?
Proxy, no custom user-agent.
Also experienced this just now. Not using a proxy or custom user agent. I was able to download two other videos just fine and then the third one threw this error. I retried with another video to be sure I wasn't being rate-limited by YouTube and it worked fine.
Edit:
Not sure if this is relevant, but I'm using Ubuntu on Windows Subsystem for Linux. I have no idea if that counts as using a 'proxy' or anything.
secondaryResults is undefined in some videos that caused this error. I added if (!secondaryResults) return [] in info-extras.js after line 138 to fix that issue temporarily. But I have no idea to get related videos. Tested video id: NeQM1c-XCDc
this has been happening during daily tests too
https://github.com/fent/node-ytdl-core/runs/936410701?check_suite_focus=true
will look into it
I found this problem today happening in the webserver that I hosted on Digital Ocean. I thought it was a problem in my code, but I just ran the webserver locally in my machine and it works.
After some investigation it seems that the related videos (where the bug is coming from) change on YouTube, depending on our location. And my server is running in Germany where, for some reason, there's a problem getting the related videos data but when I run the code locally it gets the related videos based on my location in Sweden.
Some more info: 3 hours after my previous message here, the code that couldn't extract info running in my webserver is suddenly working now. I didn't change anything in my code.
I'm with @aidangoettsch and I think it's worth merging #509 because this problem with YouTube seem to come and go out of nowhere.
I know the author of #509, he's a good guy, worth merging his stuff 馃槈