sedmelluq / lavaplayer

Audio player library for Discord
Apache License 2.0
973 stars 247 forks source link

How to play youtube by video title? #508

Closed Hanzanka closed 4 years ago

Hanzanka commented 4 years ago

This isn't a issue. Could someone more experienced tell me how i can play youtube sounds bu video title, or provide a website that shows how to do that?

MCOfficer commented 4 years ago

You can prefix queries with ytsearch:, this will make lavaplayer search for this query on youtube. The search results will be loaded as Playlist, so make sure to check your playlists for isSearchResult.

See for example: https://github.com/sedmelluq/lavaplayer/blob/b0c536098c4f92e6d03b00f19221021f8f50b19b/testbot/src/main/java/com/sedmelluq/discord/lavaplayer/demo/LocalPlayerDemo.java#L28-L30 https://github.com/EndlessSkyCommunity/EndlessSky-Discord-Bot/blob/master/src/main/java/me/mcofficer/james/audio/Audio.java#L77-L88


In the future, please ask questions in #lavaplayer on the JDA Discord instead of the issue tracker.

Hanzanka commented 4 years ago

It was that easy:D, Thanks!