Closed rpyuser closed 7 years ago
am interested in this as well. Just got it up and running for the first time and it does not seem to be working
The point of AudioSources is exactly this: to be able to easily subclass them. Making a YTDL-based audio source shouldn't really prove that hard if you know what you're doing.
looks like it wasnt removed. http://discordpy.readthedocs.io/en/latest/api.html#voice
You have to do pip install youtube_dl.
The documentation on this is all over the place.
That link points to async docs, not rewrite.
You can still get the source url through youtube_dl manually and pass it through discord.FFmpegPCMAudio().
Going off of Neko's comment, you can get the info of a youtube link (which includes a bunch of data, including the direct download links) using the following code (requires pip install youtube-dl
obviously)
import youtube_dl
opts = {}
with youtube_dl.YoutubeDL(opts) as ydl:
song_info = ydl.extract_info('https://www.youtube.com/watch?v=dQw4w9WgXcQ', download=False)
Then song_info will give you a huge dictionary filled with data. You'll have to play around with it yourself and find what you want out of the data you get. Then pass it in discord.FFmpegPCMAudio() like Neko said.
Considering there's an example that uses YTDL, I'm gonna close this.
fuck you
For anyone who's found this thread on google still trying to figure out how this works, the example Rapptz was talking about is here: https://github.com/Rapptz/discord.py/blob/master/examples/basic_voice.py. You'll want to check out the methods yt and stream on lines 78 and 88
I noticed that youtube_dl players cannot be used anymore because of the fact that the 'create_ytdl_player' function was removed. Do you have any plan to provide something to help people get the data they need for playing youtube / SoundCloud videos in voice channels including the name and duration of such videos? I would hate to hack create my own AudioSource subclass just so I can play the videos like I can do with the latest 0.16.7 version on PyPi. I just would like something to help with this need of mine for a bot I am planning to make and still working on.