如何在 Linux 中使用“youtube-dl”下载 Facebook 视频?

Mad*_*kam 17 command-line youtube-dl

我无法使用 下载 Facebook 视频youtube-dl。下载过程中出现以下错误:

$ youtube-dl https://www.facebook.com/video.php?v=10152588878600983&set=vb.107925785982&type=2&theater
[1] 5101
[2] 5102
[3] 5103
theater: command not found
[2]-  Done                    set=vb.107925785982
[3]+  Done                    type=2
[2]-  Done                    set=vb.107925785982
[3]+  Done                    type=2
$ [generic] video: Requesting header

$ WARNING: Falling back on generic information extractor.
[generic] video: Downloading webpage
ERROR: Unable to download webpage: <urlopen error [Errno 8] _ssl.c:510: EOF occurred in violation of protocol>

[1]+  Exit 1                  youtube-dl
https://www.facebook.com/video.php?v=10152588878600983
Run Code Online (Sandbox Code Playgroud)

ear*_*Lon 14

使用时youtube-dl尝试清理您使用的 URL。例如,以下 URL起作用。谢谢你的视频^_~。

你是怎么安装的youtube-dl?如果您通过 安装它apt,我会推荐以下内容:

sudo apt-get remove youtube-dl
sudo apt-get install $(apt-cache depends youtube-dl | grep Depends | sed "s/.*ends:\ //" | tr '\n' ' ')
sudo pip install youtube-dl
Run Code Online (Sandbox Code Playgroud)

pip 似乎有一个更新的版本。

需要对某些字符进行转义以防止出现问题。您可以单引号您的 URL 以帮助防止这些问题:

  • youtube-dl 'https://domain.tld/path/file.ext'


小智 9

您必须转义和号 ( &) 或将整个 URL 放在引号中,因为和号是 shell 解释的特殊字符之一,可防止您将整个 URL 传递给 youtube-dl。更多关于这一点。所以只需将它放在单引号中就足够了:

youtube-dl 'https://www.facebook.com/video.php?v=10152588878600983&set=vb.107925785982&type=2&theater'
Run Code Online (Sandbox Code Playgroud)