Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

secondaryResults is not iterable when calling getInfo #654

Closed
aidangoettsch opened this issue Jun 11, 2020 · 9 comments
Closed

secondaryResults is not iterable when calling getInfo #654

aidangoettsch opened this issue Jun 11, 2020 · 9 comments
Labels

Comments

@aidangoettsch
Copy link

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.

@fent fent added the bug label Jun 13, 2020
@gdoron
Copy link
Contributor

gdoron commented Jun 14, 2020

Yeah, I still see it from time to time.

@fent
Copy link
Owner

fent commented Jul 1, 2020

are you using a custom user-agent or proxy?

@gdoron
Copy link
Contributor

gdoron commented Jul 2, 2020

Proxy, no custom user-agent.

@Drift91
Copy link

Drift91 commented Aug 1, 2020

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.

@skick1234
Copy link
Contributor

skick1234 commented Aug 2, 2020

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

@fent
Copy link
Owner

fent commented Aug 2, 2020

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

@vegidio
Copy link

vegidio commented Aug 3, 2020

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.

@vegidio
Copy link

vegidio commented Aug 3, 2020

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.

@gdoron
Copy link
Contributor

gdoron commented Aug 4, 2020

I know the author of #509, he's a good guy, worth merging his stuff 😉

@fent fent closed this as completed in 6b051d8 Aug 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants