我正在使用pip包spotdl(https://pypi.org/project/spotdl/),遇到以下错误。尝试下载播放列表时发生这种情况。
ERROR: HTTP Error 403: Forbidden
Traceback (most recent call last):
File "c:\users\anish\appdata\local\programs\python\python38-32\lib\site-packages\spotdl\downloader.py", line 213, in _download_list
track_dl.download_single()
File "c:\users\anish\appdata\local\programs\python\python38-32\lib\site-packages\spotdl\downloader.py", line 120, in download_single
return self._download_single(songname)
File "c:\users\anish\appdata\local\programs\python\python38-32\lib\site-packages\spotdl\downloader.py", line 128, in _download_single
if youtube_tools.download_song(input_song, self.content):
File "c:\users\anish\appdata\local\programs\python\python38-32\lib\site-packages\spotdl\youtube_tools.py", line 191, in download_song
link.download(filepath=filepath)
File "c:\users\anish\appdata\local\programs\python\python38-32\lib\site-packages\pafy\backend_youtube_dl.py", line 181, in download
downloader.download(filepath, infodict)
File "c:\users\anish\appdata\local\programs\python\python38-32\lib\site-packages\youtube_dl\downloader\common.py", line 366, in download
return self.real_download(filename, info_dict)
File "c:\users\anish\appdata\local\programs\python\python38-32\lib\site-packages\youtube_dl\downloader\http.py", line 341, in real_download
establish_connection()
File "c:\users\anish\appdata\local\programs\python\python38-32\lib\site-packages\youtube_dl\downloader\http.py", line 109, in establish_connection
ctx.data = self.ydl.urlopen(request)
File "c:\users\anish\appdata\local\programs\python\python38-32\lib\site-packages\pafy\backend_youtube_dl.py", line 191, in urlopen
return g.opener.open(url)
File "c:\users\anish\appdata\local\programs\python\python38-32\lib\urllib\request.py", line 531, in open
response = meth(req, response)
File "c:\users\anish\appdata\local\programs\python\python38-32\lib\urllib\request.py", line 640, in http_response
response = self.parent.error(
File "c:\users\anish\appdata\local\programs\python\python38-32\lib\urllib\request.py", line 569, in error
return self._call_chain(*args)
File "c:\users\anish\appdata\local\programs\python\python38-32\lib\urllib\request.py", line 502, in _call_chain
result = func(*args)
File "c:\users\anish\appdata\local\programs\python\python38-32\lib\urllib\request.py", line 649, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden
WARNING: Failed to download song. Will retry after other songs
您能帮我修复它吗? 是否应该更改代码中提供的youtube和Spotify的API密钥?当我尝试单首歌曲时,也会发生相同的错误。
答案 0 :(得分:1)
尝试使用此命令vartest
。它为我工作。我还使用了自己的Youtube API密钥,所以我不确定是不是更改还是只是缓存清除才起作用。
答案 1 :(得分:0)
Go through this github repo,尽管有时与spotdl合作有时会很费劲,但您会了解所有内容,但是一旦在计算机中完成配置,这将是一次投资,您可以使用任何播放列表或歌曲,请确保先安装ffmpeg {{ 3}}。