Задать вопрос

Почему не работает youtube_dl disnake?

from disnake.ext import commands
from disnake import Client, FFmpegPCMAudio
import asyncio
import youtube_dl


class MusicCog(commands.Cog):
    def __init__(self, bot: Client):
        self.bot = bot
        self.voice_clients = {}
        self.yt_dl_opts = {'format': 'bestaudio/best'}
        self.ytdl = youtube_dl.YoutubeDL(self.yt_dl_opts)
        self.ffmpeg_options = {'options': "-vn"}

    @commands.command()
    async def play(self, ctx, url: str):
        try:
            voice_client = await ctx.author.voice.channel.connect()
            self.voice_clients[voice_client.guild.id] = voice_client
        except:
            print("Ошибочка")

        try:
            loop = asyncio.get_event_loop()
            data = await loop.run_in_executor(None, lambda: self.ytdl.extract_info(url, download=False))
            song = data['url']
            player = FFmpegPCMAudio(song, **self.ffmpeg_options, executable="C:\\Frezee\\ffmpeg\\bin\\ffmpeg.exe")

            self.voice_clients[ctx.guild.id].play(player)

        except Exception as err:
            print(err)


def setup(bot):
    print('Module Music is loaded')
    bot.add_cog(MusicCog(bot))


[youtube] UoP6zDAC-9o: Downloading webpage
ERROR: Unable to extract uploader id; please report this issue on Ссылка удалена модератором.  . Make sure you are using the latest version; see  Ссылка удалена модератором.   on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
ERROR: Unable to extract uploader id; please report this issue on Ссылка удалена модератором.  . Make sure you are using the latest version; see  Ссылка удалена модератором.   on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
  • Вопрос задан
  • 129 просмотров
Подписаться 1 Простой 1 комментарий
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы