错误:
youtube_dl.utils.DownloadError:错误:查询“歌曲”:无法解析 JSON(由 JSONDecodeError 引起('期望值:第 1 行第 1 列(字符 0)')
播放命令:
@commands.command(name='play',aliases=['p'] )
async def _play(self, ctx: commands.Context, *, search: str):
async with ctx.typing():
try:
source = await YTDLSource.create_source(ctx, search, loop=self.bot.loop)
except YTDLError as e:
await ctx.send('Error: {}'.format(str(e)))
else:
song = Song(source)
await ctx.voice_state.songs.put(song)
Youtube-DL 类:
class YTDLSource(discord.PCMVolumeTransformer):
YTDL_OPTIONS = {
'format': 'bestaudio/best',
'extractaudio': True,
'audioformat': 'mp3',
'outtmpl': '%(extractor)s-%(id)s-%(title)s.%(ext)s',
'restrictfilenames': True,
'noplaylist': True,
'nocheckcertificate': True,
'ignoreerrors': False,
'logtostderr': False,
'quiet': True,
'no_warnings': True,
'default_search': 'auto',
'source_address': '0.0.0.0',
}
FFMPEG_OPTIONS = {
'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5',
'options': '-vn',
}
ytdl = youtube_dl.YoutubeDL(YTDL_OPTIONS)
请指导我如何解决此错误此错误上周开始对我来说,并且我的 youtube_dl 也已更新
如果您需要其他代码,请告诉我,但请解决我的问题
我也不知道如何获取包括堆栈跟踪在内的错误消息