错误:使用 youtube-dl 下载 YouTube 视频时无法提取信息部分

错误:使用 youtube-dl 下载 YouTube 视频时无法提取信息部分

恕我直言,我不认为这个问题是那个由于以下原因:

  1. 让我们首先考虑一下标题:我如何更新 youtube-dl?,明确关注单个应用程序/更新过程,而不是仅关注一个应用程序的下载失败报告。
  2. 标签:本问题:视频、下载、YouTube。 另一个:apt、更新、youtube。他们只有YouTube共同的标签。
  3. 这两个问题有重叠的主题,但它们并不是相同的问题,因为另一个问题的主题是这个问题主题的子集。

现在让我们看看更多的参数(在括号中):


我尝试首先通过 Firefox + Video DownloadHelper 下载一些 YouTube 视频,然后通过 VLC 下载,最后通过 youtube-dl 程序下载,但有一些东西阻止了它们。

另一个:”我使用 youtube-dl 下载视频以便以后离线观看“,这个问题再次集中在 YouTube 中的下载阻止,无论应用程序是什么,以及另一个在单个应用程序中(youtube-dl)

在描述屏幕上我没有看到任何有关下载的限制。

其他问题中没有提到这一点。

举个例子:我试图下载两个具有相同类别/许可证的视频,第一个视频运行正常,而第二个却返回异常:

luis@jupiter:~$ youtube-dl "https://www.youtube.com/watch?v=wo6Sq1h2DI4"
[youtube] wo6Sq1h2DI4: Downloading webpage
[youtube] wo6Sq1h2DI4: Downloading video info webpage
[youtube] wo6Sq1h2DI4: Extracting video information
[youtube] wo6Sq1h2DI4: Downloading MPD manifest
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[download] Destination: SÂNSCRITO - Aula 6 (Consoantes Mudas Dentais) com Jonas Masetti-wo6Sq1h2DI4.f137.mp4
[download] 100% of 142.54MiB in 04:11
[download] Destination: SÂNSCRITO - Aula 6 (Consoantes Mudas Dentais) com Jonas Masetti-wo6Sq1h2DI4.f251.webm
[download] 100% of 8.75MiB in 00:16
[ffmpeg] Merging formats into "SÂNSCRITO - Aula 6 (Consoantes Mudas Dentais) com Jonas Masetti-wo6Sq1h2DI4.mkv"
Deleting original file SÂNSCRITO - Aula 6 (Consoantes Mudas Dentais) com Jonas Masetti-wo6Sq1h2DI4.f137.mp4 (pass -k to keep)
Deleting original file SÂNSCRITO - Aula 6 (Consoantes Mudas Dentais) com Jonas Masetti-wo6Sq1h2DI4.f251.webm (pass -k to keep)
luis@jupiter:~$ youtube-dl "https://www.youtube.com/watch?v=BbbhZl8xqVY"
[youtube] BbbhZl8xqVY: Downloading webpage
[youtube] BbbhZl8xqVY: Downloading video info webpage
[youtube] BbbhZl8xqVY: Extracting video information
[youtube] BbbhZl8xqVY: Downloading js player en_US-vflHuW2fm
ERROR: Signature extraction failed: Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/youtube_dl/extractor/youtube.py", line 905, in _decrypt_signature
    video_id, player_url, s
  File "/usr/lib/python2.7/dist-packages/youtube_dl/extractor/youtube.py", line 820, in _extract_signature_function
    res = self._parse_sig_js(code)
  File "/usr/lib/python2.7/dist-packages/youtube_dl/extractor/youtube.py", line 883, in _parse_sig_js
    initial_function = jsi.extract_function(funcname)
  File "/usr/lib/python2.7/dist-packages/youtube_dl/jsinterp.py", line 241, in extract_function
    raise ExtractorError('Could not find JS function %r' % funcname)
ExtractorError: Could not find JS function u'Ny'; 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(u"Could not find JS function u'Ny'; 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.

这是 YouTube 限制、视频编码问题还是 Ubuntu 签名问题?如果这是 YouTube 限制,那么这是针对所有 YouTube 视频的限制,还是有选择性地限制,例如针对新上传的视频,但不针对几年前上传的视频?

另一个问题的输出:

ERROR: Unable to extract info section; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type youtube-dl -U to update.

输出有点不同,不是吗?


最后还有两个问题需要考虑

  • 虽然 youtube-dl 的升级帮助我解决了我的问题,但它并没有回答我的这一项问题:我尝试下载 2 个具有相同类别/许可证的视频,第一个运行正常,而第二个则返回异常。
  • 另一个问题是在 2013 年提出的,我相信从那时起 YouTube 服务和应用程序的访问方式发生了一些变化

答案1

第一个视频使用最近更新的 youtube-dl 版本成功下载,该版本是我python pip install youtube-dl在 Python 虚拟环境中使用 python-pip 安装的(python-virtualenv)。有关如何设置和使用 Python 虚拟环境的信息,请参阅如何在 Ubuntu 中设置和使用虚拟 Python 环境?

我用来显示可用视频格式的命令是:

youtube-dl -F "https://www.youtube.com/watch?v=wo6Sq1h2DI4"

我用来下载第一个 YouTube 视频的命令是:

youtube-dl -f 18 "https://www.youtube.com/watch?v=wo6Sq1h2DI4"

第二个视频无法使用 youtube-dl 下载,但我没有放弃。我通过运行以下命令将 youtube-dl 升级到最新版本:

pip install --upgrade youtube-dl  # inside the Python virtual environment

我不需要使用,sudo因为我的 Python 虚拟环境安装在我自己的用户目录中(~/my-Python-virtual-env)。升级 youtube-dl 后,我运行此命令来下载第二个 YouTube 视频:

youtube-dl -f 18 "https://www.youtube.com/watch?v=BbbhZl8xqVY"

为什么不简单地使用 sudo pip install --upgrade youtube-dl

我使用 Ubuntu 的原因之一是摆脱 Windows 安装应用程序的繁琐方式。只要有可能,我就会从默认的 Ubuntu 存储库安装软件包。在这种情况下,我知道 youtube-dl 是一个 Python 程序,因此我可以在 Python 虚拟环境中本地安装最新版本的 youtube-dl,而不会弄乱我的文件系统。

另一种选择是安装 youtube-dl snap 包:

sudo snap install youtube-dl # start with snap run youtube-dl 

我相信从现在起 YouTube 的服务和应用程序访问方式已经发生了一些变化。

没错。与三年前相比,谷歌现在更频繁地改变访问 YouTube 视频的方式,因此为了保持 youtube-dl 的最新状态,它也必须更频繁地更新。多年来,我观察到 YouTube 视频被屏蔽的原因似乎主要与上传日期有关。

在开始使用 youtube-dl 之前,我使用名为 Video DownloadHelper 的 Firefox 扩展程序来下载 YouTube 视频。我更喜欢 youtube-dl,因为它是我用过的所有下载器中成功抓取 YouTube 视频的概率最高的。

答案2

YouTube 的视频下载能力一直是个难题,因为该公司试图将访问网站的方式限制在他们喜欢的方式。摘自 YouTube 服务条款:

您同意不通过除服​​务本身的视频播放页面、可嵌入播放器或 YouTube 可能指定的其他明确授权的方式之外的任何技术或方式访问内容。

的制作者youtube-dl不断尝试适应 YouTube 所做的更改,旨在引导用户回到他们喜欢的访问方式。这就是您在下载时遇到的问题。

的存储库版本youtube-dl是一个老版本2016.02.22,战线早已从那里转移到最近的版本报告:

andrew@ilium~$ youtube-dl --version
2016.08.10

推荐的更新方法youtube-dl来自youtube-dl 下载页面,稍微修改一下以删除 Ubuntu 存储库版本:

sudo apt-get remove youtube-dl
sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl

在同一个下载页面上,您将看到使用 curl 和 pip 进行升级的说明,使用您喜欢的任何一个,因为最终结果是相同的。但删除存储库版本很重要,您只需要一个youtube-dl可执行文件。

笔记:在我自己的系统上进行测试后,以这种方式升级,完全解决了您的问题并成功下载了两个视频。

如果你好奇看看这里战斗是从 YouTube 页面中提取地址(此页面显示了错误的来源)并查看需要付出的努力以提供合适的匹配才能成功下载。

参考:

相关内容