Проблема 'Попытка установить соединение была безуспешной

Рейтинг: 0Ответов: 0Опубликовано: 28.02.2023

Мой код:

import discord
import config
from discord.ext import commands
from youtube_dl import YoutubeDL

YDL_OPTIONS = {'format': 'worstaudio/best', 'noplaylist': 'False', 'simulate': 'True', 'key': 
'FFmpegExtractAudio'}
FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 
5', 'options': '-vn'}
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix='~', intents=intents)
@bot.event
async def on_ready():
    print('Работаем')
@bot.command()
async def play(ctx, url):
    await ctx.message.author.voice.channel.connect()

    with YoutubeDL(YDL_OPTIONS) as ydl:
        if 'https://' in url:
            info = ydl.extract_info(url, download=False)
        else:
            info = ydl.extract_info(f"ytsearch:{url}", download=False)['entries'][0]

    aboba = info['formats'][0]['url']
    vc.play(discord.FFmpegPCMAudio(executable='ffmpeg\\ffmpeg.exe', source=aboba, 
**FFMPEG_OPTIONS))

bot.run(config.token)

При запуске и подаче команды бот заходит, но трек качается долго, а вскоре вылезет тонна ошибок, в конце:

Попытка установить соединение была безуспешной, т.к. от другого компьютера за требуемое время не получен нужный отклик, или было разорвано уже установленное соединение из-за неверного отклика уже подключенного компьютера', None, 10060, None)))

честно скажу в питоне я ноль, а код нужен для проекта, ffmpeg и PyNaCl 1.5 установлены

Ошибка:

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: DownloadError: ERROR: Unable to extract uploader id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

[youtube] XjvBP7JzbFM: Downloading webpage
[youtube] Downloading just video XjvBP7JzbFM because of --no-playlist

ERROR: Unable to extract uploader id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
2023-02-28 18:56:39 ERROR    discord.ext.commands.bot Ignoring exception in command play
Traceback (most recent call last):
   line 815, in wrapper
    return func(self, *args, **kwargs)
  line 836, in __extract_info
    ie_result = ie.extract(url)
  line 534, in extract
    ie_result = self._real_extract(url)
  line 1794, in _real_extract
    'uploader_id': self._search_regex(r'/(?:channel|user)/([^/?&#]+)', owner_profile_url, 'uploader id') if owner_profile_url else None,
  line 1012, in _search_regex
    raise RegexNotFoundError('Unable to extract %s' % _name)
youtube_dl.utils.RegexNotFoundError: Unable to extract uploader id; please report this issue onMake 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.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  line 229, in wrapped
    ret = await coro(*args, **kwargs)
  line 29, in play
    info = ydl.extract_info(url, download=False)
  line 808, in extract_info
    return self.__extract_info(url, ie, download, extra_info, process)
  line 824, in wrapper
    self.report_error(compat_str(e), e.format_traceback())
 line 628, in report_error
    self.trouble(error_message, tb)
  line 598, in trouble
    raise DownloadError(message, exc_info)
youtube_dl.utils.DownloadError: ERROR: Unable to extract uploader id; please report this issue Make sure you are using the latest version; on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  line 1349, in invoke
    await ctx.command.invoke(ctx)
  line 1023, in invoke
    await injected(*ctx.args, **ctx.kwargs)  # type: ignore
  line 238, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: DownloadError: ERROR: Unable to extract uploader id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

Ответы

Ответов пока нет.