我有一个名为 downloadSong 的函数,用于在给定 url 时从 youtube 下载歌曲,但它会出现错误
我试过搜索文档并阅读我,但我没有看到任何提到这个错误
def downloadSong(url):
yt = YouTube(str(url))
video = yt.streams.first()
downloadedVideo = video.download('/MusicCache')
return downloadedVideo,yt.title
预期的结果是它下载了歌曲,但它绘制了如下所示的错误:
File "C:\Users\USER\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\bot.py", line 859, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\USER\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 725, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\USER\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 88, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: KeyError: 's'```