How to download Facebook videos from command line?

5,860

What version of Ubuntu & youtube-dl are you using?

To make sure you're using the latest youtube-dl available, do the following:

sudo add-apt-repository ppa:nilarimogard/webupd8 
sudo apt-get update
sudo apt-get install youtube-dl

After doing the above in Ubuntu 14.04 Trusty, I got 2018.01.07 version of youtube-dl and was able to download the video in question:

youtube-dl 'https://www.facebook.com/Roscosmos/videos/2032700800317930'
WARNING: Assuming --restrict-filenames since file system encoding cannot encode all characters. Set the LC_ALL environment variable to fix this.
[facebook] 2032700800317930: Downloading webpage
WARNING: Your copy of avconv is outdated and unable to properly mux separate video and audio files, youtube-dl will download single file media. Update avconv to version 10-0 or newer to fix this.
[download] Destination: _-2032700800317930.mp4
[download] 100% of 3.36MiB in 00:01

The video download now fails, however, due to another reason. It will only download a single part of the video, and will not proceed further.

The reason is that youtube-dl uses libav to combine downloaded files, while libav available in the system is outdatedyoutube-dl expects version at least 10.0, but the system has 9.2:

dpkg -l | grep libav-tools
ii  libav-tools                       6:9.20-0ubuntu0.14.04.1                    amd64        Multimedia player, server, encoder and transcoder

Weirdly, I could not find any quick way to install latest libav in Ubuntu 14.04.

I guess at this point the only way to make this youtube-dl work would be to build & install libav manuallyhttps://libav.org/download/.

Someone actually stumbled upon a similar issue that required him to figure out how to build libav. Here are the detailed step-by-step instructinos: http://xiemingzhi.github.io/2016/03/25/installing-libav-on-ubuntu-1404-trusty

Share:
5,860

Related videos on Youtube

Roman
Author by

Roman

Updated on September 18, 2022

Comments

  • Roman
    Roman over 1 year

    I try to download videos from Facebook from command line. This is what I have used:

    youtube-dl https://www.facebook.com/Roscosmos/videos/2032700800317930
    

    And as a result I get this error message:

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

    I have tried to follow instructions from here. In more detail, I used:

    youtube-dl https://www.facebook.com/videos.php?v=2032700800317930
    

    But I still get the same problem. Putting the URL into quotation signs does not help as well.

    • gota
      gota over 5 years
      I can confirm I can download facebook videos with youtube-dl