Discord.py: Cannot create an youtube_dl player on rewrite

Created on 9 May 2017  路  8Comments  路  Source: Rapptz/discord.py

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.

v1.0-alpha

Most helpful comment

That link points to async docs, not rewrite.

All 8 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ThePiGuy24 picture ThePiGuy24  路  17Comments

johndoe434 picture johndoe434  路  21Comments

wolfclaws picture wolfclaws  路  17Comments

haaddaa1 picture haaddaa1  路  14Comments

0x78f1935 picture 0x78f1935  路  20Comments