Skip to content
Advertisement

How do I make my discord bot play music by using youtubedl’s search function instead of url? (Python)

I want it to search for the video and play it, how can i change the following code to achieve that? Every time I use the ytsearch function in ytdl, I notice that it only searches for the first word of the title and download it, however, it causes error later on and do nothing.

JavaScript

And this is the error message:

JavaScript

Thanks.

Advertisement

Answer

To resolve the issue of the URL:

JavaScript

And the issue of only one word being taken into the search query:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement