![无法再使用 youtube-dl 下载 YouTube。如何解决此问题?](https://linux22.com/image/1184732/%E6%97%A0%E6%B3%95%E5%86%8D%E4%BD%BF%E7%94%A8%20youtube-dl%20%E4%B8%8B%E8%BD%BD%20YouTube%E3%80%82%E5%A6%82%E4%BD%95%E8%A7%A3%E5%86%B3%E6%AD%A4%E9%97%AE%E9%A2%98%EF%BC%9F.png)
当我运行 youtube-dl 时,我收到以下消息(很长)。这是什么问题?我该如何解决?它告诉我更新 youtube-dl,但我正在使用 youtube-dl 执行命令在终端中运行它 - 我认为它实际上并未安装在我的 PC 上。
ERROR: Signature extraction failed: Traceback (most recent call last):
File "/snap/youtube-dl/4572/lib/python3.6/site-packages/youtube_dl/extractor/youtube.py", line 1361, in _decrypt_signature
video_id, player_url, s
File "/snap/youtube-dl/4572/lib/python3.6/site-packages/youtube_dl/extractor/youtube.py", line 1274, in _extract_signature_function
res = self._parse_sig_js(code)
File "/snap/youtube-dl/4572/lib/python3.6/site-packages/youtube_dl/extractor/youtube.py", line 1343, in _parse_sig_js
initial_function = jsi.extract_function(funcname)
File "/snap/youtube-dl/4572/lib/python3.6/site-packages/youtube_dl/jsinterp.py", line 245, in extract_function
raise ExtractorError('Could not find JS function %r' % funcname)
youtube_dl.utils.ExtractorError: Could not find JS function 'na'; 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.
(caused by ExtractorError("Could not find JS function 'na'; 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.",)); 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.
答案1
该youtube-dl
项目已非正式地停止运营。自 6 月以来,该项目一直没有更新,尽管之前非常活跃。项目维护人员没有发布任何回应,而且该项目从几个月前开始在许多网站上出现严重问题。
许多人已经移居到yt-dlp
,它有几个安装选项,包括 PIP。
答案2
更新:
推荐的解决方案是使用yt-dlp
原始回应:
这是一个几天前开始出现的已知问题,这里是 github 问题页面:
https://github.com/ytdl-org/youtube-dl/issues/30363
修复方法如下:
https://github.com/ytdl-org/youtube-dl/pull/30366/commits/1a091687c248b62c2f0a6070519bd78417828746
您必须等待下一个版本。
或者,如果您很着急并且等不及下一个版本,您可以手动编辑安装中的“youtube.py”文件。
在我的安装中,该文件位于:
/usr/local/lib/python3.8/dist-packages/youtube_dl/extractor/youtube.py
我手动进行了替换,然后再次下载。
答案3
我刚刚创建了一个拉取请求来修补它。简而言之,youtube 将其双字符函数更改为三字符函数:它破坏了 youtube-dl 的正则表达式。
如果您将项目拉到本地,则在终端中运行它:
python -m youtube_dl -x --audio-format mp3 https://youtu.be/lhXFIz0pVv4
它应该下载到项目文件夹中。