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

[BUG] Unable to play YouTube links - "Could not extract stream for this track" error #75

Closed
ColdMeekly opened this issue Apr 5, 2023 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@ColdMeekly
Copy link

Describe the bug
Whenever trying to play a YouTube link via Discord, the bot joins the voice channel, but shortly after replies in-chat with the message This media doesn't seem to be working right now, please try again later. and then leaves. In the console, the error message [Melody] ERROR: An error occurred whilst attempting to play this media: [Melody] ERROR: Error: Could not extract stream for this track is printed.

To Reproduce
Steps to reproduce the behavior:

  1. Use the /play command
  2. Enter a query containing a YouTube link
  3. Wait for the bot to join the voice channel
  4. Observe the error message in the chat and console

Expected behavior
The bot should join the voice channel and play the requested media without any errors.

Actual behavior
The bot joins the voice channel, but is unable to play the media and leaves shortly after.

Screenshots
image

Log File
https://paste.techy.lol/ldWd9RlBLY.less

Additional context
URLs tried:

  1. https://www.youtube.com/watch?v=G7KNmW9a75Y&list=PLx0sYbCqOb8Q_CLZC2BdBSKEEB59BOPUM
  2. https://www.youtube.com/watch?v=5QCBkwmsOk0
@ColdMeekly ColdMeekly added the bug Something isn't working label Apr 5, 2023
@NerdyTechy
Copy link
Owner

Thanks for the report, I'm aware of this and am looking for a fix, it's an issue with one of the packages that Melody relies on so it's not something that I can change immediately, but I'll try and find a workaround until this is resolved.

@NerdyTechy NerdyTechy pinned this issue Apr 5, 2023
@NerdyTechy

This comment was marked as outdated.

@ColdMeekly
Copy link
Author

Almost worked! We're getting different errors now.
When playing a single link, it does not join the voice channel and throws the following message:
image

And when attempting a playlist, it joins the voice channel thinks for a very long time:
image
This is the error log from running this 2nd command:
https://paste.techy.lol/ohJjOx6igr.less

@ColdMeekly
Copy link
Author

Seems to be same issue as: fent/node-ytdl-core#635

@NerdyTechy
Copy link
Owner

Thanks for the update, I'll take a look into this

@NerdyTechy
Copy link
Owner

Almost worked! We're getting different errors now. When playing a single link, it does not join the voice channel and throws the following message: image

And when attempting a playlist, it joins the voice channel thinks for a very long time: image This is the error log from running this 2nd command: https://paste.techy.lol/ohJjOx6igr.less

A 429 response means that YouTube received too many requests for songs and is rate limiting you, so the chances are that if you wait a couple of hours this issue will just disappear. This is likely to happen if you're using shared hosting like Heroku where multiple people are requesting from the same machine. I'll look into this to see if there's a cookie or something that I can set to try and avoid this for people that are using shared hosting, but for now your best bet is to simply wait for the rate limit to expire.

NerdyTechy added a commit that referenced this issue Apr 6, 2023
Force play-dl as stream engine (#75)
@NerdyTechy
Copy link
Owner

I've just pushed a commit that should resolve this issue for future users. If you're still experiencing issues, and don't want to redownload the bot to update, you can fix this "Could not extract stream for this track" error by following these steps:

  1. Open src/bot.js
  2. At the very top of the file, insert a new line with this content: process.env['DP_FORCE_YTDL_MOD'] = "play-dl";
  3. Save the file
  4. Restart the bot

Alternatively, download the latest code from GitHub.

I'm still looking into the rate limiting issue, but it seems that sometimes even setting session cookies can't resolve the issue, so unfortunately it may just be an issue for those using shared hosting platforms.

@ColdMeekly
Copy link
Author

Just wanted to clarify, I'm hosting on a dedicated linux box, no discord bots are running on it except for this one. And the rate limit is super strange as the youtube playlist causes it every time.

Almost worked! We're getting different errors now. When playing a single link, it does not join the voice channel and throws the following message: image

And when attempting a playlist, it joins the voice channel thinks for a very long time: image This is the error log from running this 2nd command: https://paste.techy.lol/ohJjOx6igr.less

Also I'm still encountering both of these issues, but probably gonna put them into a separate issue sometime later since it's unrelated to this one I think.

@NerdyTechy
Copy link
Owner

Just made a new issue for this to avoid clutter, I'll respond in there regarding this from now onwards

@ColdMeekly
Copy link
Author

This is solved for me, if there's anything you would like to add or if this happens for anyone else feel free to re-open :)

@NerdyTechy NerdyTechy unpinned this issue Apr 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants