July 25, 2008 · General · Email This Post
Share
{lang: 'en-GB'}

youtube-dl is a small command-line program to download videos from YouTube.com.

Install youtube-dl in Ubuntu

sudo aptitude install youtube-dl

This will complete the installation.

Using youtube-dl

Usage instructions are easy. Use youtube-dl followed by a video URL or identifier.

youtube-dl Example

youtube-dl “http://www.youtube.com/watch?v=foobar”

The video will be saved to the file foobar.flv in that example. As YouTube.com videos are in Flash Video format, their extension should be flv.Check this simple guide to convert .flv files to .mpg

More usage tips

You can change the file name of the video using the -o option, like in

youtube-dl -o vid.flv “http://www.youtube.com/watch?v=foobar”.

Some videos require an account to be downloaded, mostly because they’re flagged as mature content. You can pass the program a username and password for a YouTube.com account with the -u and -p options, like

youtube-dl -u myusername -p mypassword “http://www.youtube.com/watch?v=foobar”.

The account data can also be read from the user .netrc file by indicating the -n or --netrc option. The machine name is youtube in that case.

The simulate mode (activated with -s or --simulate) can be used to just get the real video URL and use it with a download manager if you prefer that option.

The quiet mode (activated with -q or --quiet) can be used to supress all output messages. This allows, in systems featuring /dev/stdout and other similar special files, outputting the video data to standard output in order to pipe it to another program without interferences.

The program can be told to simply print the final video URL to standard output using the -g or --get-url option.

Incoming search terms:

Share

Related posts

137 Comments to “Youtube-dl - Download videos from youtube in Ubuntu”

  1. ramaflap says:

    Another way is watch the vid and then search on the Cache folder on your disk … like /home//.cache/google-chrome/Cache/
    if you are using Google-Chrome … if not, if you are using firefox … in a new window type “about:cache” and then nautilus to the cache dir…. copy and paste

    [Reply]

  2. rhecizen says:

    when I try to download video from youtube

    Retrieving video webpage… done.
    Extracting URL “t” parameter… failed.
    Error: unable to extract URL “t” parameter.
    Try again several times. It may be a temporary problem.
    Other typical problems:

    * Video no longer exists.
    * Video requires age confirmation but you did not provide an account.
    * You provided the account data, but it is not valid.
    * The connection was cut suddenly for some reason.
    * YouTube changed their system, and the program no longer works.

    Try to confirm you are able to view the video using a web browser.
    Use the same video URL and account information, if needed, with this program.
    When using a proxy, make sure http_proxy has http://host:port format.
    Try again several times and contact me if the problem persists.

    [Reply]

  3. ct529 says:

    I do not understand what is going on. If I try to download a video, this is what happens:

    $ youtube-dl “http://www.youtube.com/v/G4OkfhA0uK8″
    [youtube] Setting language
    [youtube] G4OkfhA0uK8: Downloading video info webpage
    [youtube] G4OkfhA0uK8: Extracting video information
    ERROR: format not available for video
    $

    The video is available and not protected.

    Could you please help me out?

    [Reply]

  4. Miguel says:

    @ct529, same here i try to use command line:
    youtube-dl url://

    final result is :Error: format not available for video

    i wonder what did go wrong, i followed the instructions,but this happened

    Help meeeeee..

    [Reply]

  5. Miguel says:

    Hey.

    I just updated the youtube-dl and i start working
    so just run this command line:
    sudo youtube-dl --update

    [Reply]

  6. ct529 says:

    Yes it works! Thanks!

    [Reply]

  7. ct529 says:

    By the way, I cannot download subtitles or transcript this way …. is there a way to download subtitles or transcripts?

    [Reply]

  8. 0160 says:

    ok whats the deal did youtube change something because my youtube-dl is updated and still wont work… heres the terminal results:

    thanks

    btw i can watch the video in seamonkey and firefox no problem and just open the /tmp folder and grab the downloaded file there. rename it to a filename.flv and run aconvert on it to make it a mp3 etc but i was looking for a faster way to get the file downloaded already into my working directory and even script out the convert as well but i cant get youtube-dl or even get_flash_videos to get these youtube videos. crazy…

    sudo youtube-dl --update
    Updating to latest stable version…
    Updated to version github

    youtube-dl –o SpookyAmbience1.flv http://www.youtube.com/watch?v=NAP26hS82BU
    WARNING: Falling back on generic information extractor.
    Traceback (most recent call last):
    File “/usr/bin/youtube-dl”, line 2317, in
    retcode = fd.download(all_urls)
    File “/usr/bin/youtube-dl”, line 464, in download
    ie.extract(url)
    File “/usr/bin/youtube-dl”, line 683, in extract
    return self._real_extract(url)
    File “/usr/bin/youtube-dl”, line 1578, in _real_extract
    self._downloader.trouble(u’ERROR: Invalid URL: %s’ % url)
    UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xe2 in position 0: ordinal not in range(128)

    [Reply]

  9. sobin says:

    thanks a lot….it worked!!!
    great software by which we can download the videos without affecting the browser….!!!

    by the way…there is a small change in the command to be used in linux.

    its…

    sudo apt-get install youtube-dl

    [Reply]

  10. hiren says:

    Great simple commandline stuff.

    Way to go.

    Thanks.

    [Reply]

  11. :( says:

    I have a problem downloading from youtube What are my problem solving
    __________________
    ~$ [youtube] Setting language
    [youtube] 9D4UmD42wlc: Downloading video webpage
    [youtube] 9D4UmD42wlc: Downloading video info webpage
    [youtube] 9D4UmD42wlc: Extracting video information
    ERROR: unable to download video (format may not be available)

    [Reply]

  12. multivac says:

    I had the same problem just now
    “ERROR: unable to download video (format may not be available)”

    doing “sudo youtube-dl -U” updated it to the most recent version, which works!

    [Reply]

  13. coffeereptile says:

    Yep, same problem here. But the other scripts dont work either including my own D:

    [Reply]

  14. pwned says:

    same problem here, and youtube-dl -U didn’t help (gave a syntax error in the script)

    [Reply]

  15. Max says:

    same here… but I also have a Firefox flash problem.. (Opera and Epiphany work ok) may be it’s related… dunno… would be great to have youtube-dl working !! thnx

    [Reply]

  16. Soliton says:

    “sudo youtube-dl --update” didn’t work.
    “sudo youtube-dl -U” works.

    Thanks v much!

    [Reply]

  17. Dimon says:

    RE: ““sudo youtube-dl --update” didn’t work.
    “sudo youtube-dl -U” works.”

    Here you go (Ubuntu 9.10):

    demon@comp:~$ sudo youtube-dl --update
    Usage: youtube-dl [options] video_url

    youtube-dl: error: no such option: --update
    demon@comp:~$ sudo youtube-dl -U
    Usage: youtube-dl [options] video_url

    youtube-dl: error: no such option: -U

    youtube-dl --update seems work on Ubuntu 10.04 but still wouldn’t help it to work.
    My favorite tool was clive but sadly it doesn’t work anymore.

    My advice is to get DownloadHelper extension for Firefox because it works at least, and it still better that to download a temporary file from /temp directory/

    youtube-dl SUCKS!

    [Reply]

  18. Nuxi says:

    sudo youtube-dl --update

    This will update successfully (to github), but it is not the right version

    please use sudo youtube-dl -U to the the correct update… this will eliminate the following:

    ERROR: Unable to download video (format may not be available)

    (Tested on Edubuntu Natty Narwhal 11.04)

    [Reply]

  19. naidherng says:

    use sudo youtube-dl -U
    works for me ubuntu 10.04

    Thank you

    [Reply]

  20. kuldeep says:

    youtube-dl -U
    i tried but dont work

    [Reply]

  21. joe says:

    I had to run ‘sudo youtube-dl -U’ twice to get it to update to a version that worked, first it updated to version ‘github’ which still had the format error, then to one that worked:

    user@comp:~/Desktop$ sudo youtube-dl -U
    Updating to latest stable version…
    Updated to version github
    user@comp:~/Desktop$ sudo youtube-dl http://www.youtube.com/watch?v=fEVmAbxC14g
    [youtube] Setting language
    [youtube] fEVmAbxC14g: Downloading video webpage
    [youtube] fEVmAbxC14g: Downloading video info webpage
    [youtube] fEVmAbxC14g: Extracting video information
    ERROR: unable to download video (format may not be available)
    user@comp:~/Desktop$ sudo youtube-dl -U
    Updating to latest stable version…
    Updated to version 2010.12.09
    user@comp:~/Desktop$ sudo youtube-dl http://www.youtube.com/watch?v=fEVmAbxC14g
    [youtube] Setting language
    [youtube] fEVmAbxC14g: Downloading video webpage
    [youtube] fEVmAbxC14g: Downloading video info webpage
    [youtube] fEVmAbxC14g: Extracting video information
    [download] Destination: fEVmAbxC14g.flv
    [download] 100.0% of 4.21M at 39.07k/s ETA 00:00

    [Reply]

  22. jape says:

    Thanks joe - same for me….

    I first updated to github & then updated to version 2010.12.09, now it’s working again.

    FYI - I’m using Ubuntu 11.04

    [Reply]

  23. manampy says:

    Many THX
    youtube-dl -U works
    I’m on ubuntu maverick

    [Reply]

  24. Nitesh says:

    sudo youtube-dl -U worked.sometimes u may need to use this command twice.so use this it must solve your problem.

    [Reply]

  25. brunoweb says:

    Yes! youtube-dl -U works for me.

    [Reply]

  26. Ranga says:

    wow………….this is working……..thank u all….

    [Reply]

  27. Bindu Ganga says:

    sudo youtube-dl -U works!

    [Reply]

  28. sncogn says:

    thanks a lot, sudo youtube-dl -U worked for me, too :) )

    [Reply]

  29. gaurav says:

    Do this And every video will be downloaded :
    sudo aptitude install youtube-dl
    sudo youtube-dl --update
    sudo youtube-dl -U
    sudo youtube-dl

    [Reply]

  30. St0iK says:

    sudo youtube-dl -U works for me too! Thanx!

    [Reply]

Leave a Reply