youtube-dl stopped working

On my 12.04 LTS I can't download from YouTube via youtube-dl. I used to do that, but recently (for a week) I'm not able. I tried on many videos and I get same output:

$ youtube-dl -t http://www.youtube.com/watch?v=Sh0ciyuXbJA
[youtube] Setting language
[youtube] Sh0ciyuXbJA: Downloading video webpage
[youtube] Sh0ciyuXbJA: Downloading video info webpage
[youtube] Sh0ciyuXbJA: Extracting video information
Traceback (most recent call last):
  File "/usr/bin/youtube-dl", line 4645, in <module>
    main()
  File "/usr/bin/youtube-dl", line 4636, in main
    _real_main()
  File "/usr/bin/youtube-dl", line 4620, in _real_main
    retcode = fd.download(all_urls)
  File "/usr/bin/youtube-dl", line 869, in download
    ie.extract(url)
  File "/usr/bin/youtube-dl", line 1135, in extract
    return self._real_extract(url)
  File "/usr/bin/youtube-dl", line 1406, in _real_extract
    url_map = dict((ud['itag'][0], ud['url'][0] + '&signature=' + ud['sig'][0]) for ud in url_data)
  File "/usr/bin/youtube-dl", line 1406, in <genexpr>
    url_map = dict((ud['itag'][0], ud['url'][0] + '&signature=' + ud['sig'][0]) for ud in url_data)
KeyError: 'sig'

It seems it's some signature problem. I still can download videos via vlc. But I like youtube-dl - its faster. I did already:

sudo apt-get --purge remove youtube-dl
sudo apt-get install youtube-dl
sudo youtube-dl --update

...but it didn't help.


Youtube updates his anti-download security system quite offen. You should keep your youtube-dl up-to-date. The version Ubuntu 12.04 Precis installs by default is 2012.02.27 (two years old).

You can subscribe to the WebUpd8 PPA to get new releases when they're out (that is once or twice a week) :

sudo add-apt-repository ppa:nilarimogard/webupd8 -y
sudo apt-get update
sudo apt-get dist-upgrade

You'll also find the .deb package of the latest youtube-dl release on that PPA (here and search for youtube-dl). Install it with a GUI-tool like gdebi or Ubuntu Software Center, or with these command lines :

cd directory/where/you/downloaded/the/package
dpkg -i youtube-dl*
sudo apt-get install -f

The apt-get version of youtube-dl is really outdated. If you don't want to add the ppa, you can install using git.

First, remove the outdated version:

sudo apt-get purge youtube-dl

Next, run the following commands to install:

git clone https://github.com/rg3/youtube-dl.git
cd youtube-dl
make
sudo make install

Now, to update youtube-dl to the newest version, just run the following command:

sudo youtube-dl -U

Alternatively, you can install new version from the pypi python repository:

sudo apt-get install python-pip3
sudo pip3 install youtube-dl

To update the pip version, run the following command:

sudo pip3 install youtube-dl --upgrade