2

I don't know what happened now but I'm unable to download any youtube video. Earlier it was working properly. I'm working on Ubuntu 13.04

ravbholua@ravbholua-Aspire-5315:~$ youtube-dl http://www.youtube.com/watch?v=ONWvX8ESrsk
[youtube] Setting language
[youtube] ONWvX8ESrsk: Downloading video webpage
[youtube] ONWvX8ESrsk: Downloading video info webpage
[youtube] ONWvX8ESrsk: Extracting video information
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/bin/youtube-dl/__main__.py", line 7, in <module>
  File "/usr/bin/youtube-dl/__init__.py", line 536, in main
  File "/usr/bin/youtube-dl/__init__.py", line 520, in _real_main
  File "/usr/bin/youtube-dl/FileDownloader.py", line 475, in download
  File "/usr/bin/youtube-dl/InfoExtractors.py", line 80, in extract
  File "/usr/bin/youtube-dl/InfoExtractors.py", line 405, in _real_extract
  File "/usr/bin/youtube-dl/InfoExtractors.py", line 405, in <genexpr>
KeyError: 'sig'
ravbholua@ravbholua-Aspire-5315:~$ 
  • 2
    Have you thought to update your youtube-dl tool ? – Slyx Mar 9 '14 at 4:38
  • There should be more recent versions of this script packaged for your distribution. Just upgrade to those. This script has no depedencies to speak of, so a backport should not be necessary. The current version in Debian is 2014.02.17-1. What version are you running? – Faheem Mitha Mar 9 '14 at 5:27
5

The youtube-dl script comes with its own update mechanism. Simply run this to update it:

$ youtube-dl -U

See the help (--help):

-U, --update        update this program to latest version. Make sure 
                    that you have sufficient permissions (run with sudo if 
                    needed)

This is a little cat and mouse game that users of this script have to periodically update the script, because YouTube breaks the ability to download videos from the site.

I would also encourage you to use single/double quotes when passing the URLs to youtube-dl via the command line on the off chance that they include unusual characters such as question marks and ampersands. This way, the shell does not interpret those characters!

Here's a example of using single quotes:

$ youtube-dl 'http://www.youtube.com/watch?v=ONWvX8ESrsk'

| improve this answer | |
  • 2
    I think in Ubuntu 13.10, the youtube-dl from the software center cannot be updated by running sudo youtube-dl -U. If you get youtube-dl directly from yt-dl.org, it updates perfectly with the command. – DK Bose Mar 9 '14 at 5:28
  • I see that OP is on 13.04. I don't know about that because it is EOL. Whether that will get updates of any software, IDK :( – DK Bose Mar 9 '14 at 5:29
  • 1
    Re. unusual characters, at least "basic" YouTube urls look like this: youtube.com/watch?v=........... where the eleven dots could be a-z, A-Z, 0-9, - and _. I have not seen other characters. It's quite possible that there may be unusual characters but I haven't seen them as yet. In any case, your advice is safer. – DK Bose Mar 9 '14 at 5:39
  • Here's an example: youtube.com/watch?v=CGyEd0aKWZE&feature=kp. My kids just watched this video "Ellie Goulding - Burn" today and it has an ampersand in it. – slm Mar 9 '14 at 12:50
  • Yes, that comes after the basic url and so quotes would help. – DK Bose Mar 9 '14 at 14:40
1

mps-youtube is a new tool which, besides being able to download YouTube videos (either the whole video or just the audio), can also search and play YouTube videos and create local playlists, all from the command line.

Installation

Install pip

sudo apt-get install python-pip

Then install mps-youtube using pip:

sudo pip install mps-youtube

You'll also need mplayer

sudo apt-get install mplayer

Usage

To run mps-youtube, use the following command:

mpsyt

To search for a video on YouTube, prefix your search with either "." or "/".

Example: to search for "pantera", use:

.pantera

A full tutorial can be found here

| improve this answer | |
1

For me the following lines worked:

sudo apt-get remove -y youtube-dl
wget -O - https://yt-dl.org/latest/youtube-dl | sudo tee /usr/local/bin/youtube-dl > /dev/null
sudo chmod a+x /usr/local/bin/youtube-dl
hash -r
| improve this answer | |
1

Update youtube-dl by adding this PPA:

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

Then you may download any video as usual. For example:

youtube-dl https://www.youtube.com/watch?v=Ix1rD4JD3eo

Note: It still could be downloaded using pip. It is OS independent!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.