como baixar do youtube em discord.py
import discord
from discord.ext import commands
import youtube_dl
client = commands.Bot(command_prefix = '!', intents=intents)
@client.command(pass_context = True)
async def download(ctx, url:str):
ydl_opts = {
'format': 'bestaudio/best',
'preferredcodec': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'webm',
'preferredquality': '192',
}],
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([url])
client.run(TOKEN)
Hozayfeh Azari