youtube-dl

A CLI utility to download video (or audio-only) from many popular sites, including Vimeo, YouTube, etc.
web | project | pypi | documentation | issues | Public Domain

Python package | youtube-dl
Ubuntu packages (recommended) | libav-tools (audio) rtmpdump (RTMP video)
See also | :audio

Notes

TODO: bug/howto: resume playlist download if single video fails
TODO: always use absolute number in playlist, even if starting from offset

Install / Update

If the interface for YouTube (or other sites) changes drastically, youtube-dl will stop working. So, it's best to install the latest version via pip rather than from the Ubuntu repos. This makes it updateable if a change does occur.

pip install --user youtube-dl

To update at a later date:

pip install --user -U youtube-dl

Note that we use the --user option for a local install (rather than a system install). See :python:pip for details.

Usage

To use, get the video URL and then:

youtube-dl --prefer-free-formats <URL>
# free formats option not required, but files more
# reliably played on different systems

TODO: how to conditionally convert to free format? (not just prefer)

Audio

To download audio only, make sure you have libav-tools installed, then:

youtube-dl --prefer-free-formats --extract-audio <URL>
# FIXME: keeps in non-free format? see above

youtube-dl --prefer-free-formats --extract-audio --audio-format vorbis <URL>
# force encoding as ogg/vorbis

Contributing

https://filippo.io/add-support-for-a-new-video-site-to-youtube-dl/

https://github.com/rg3/youtube-dl/blob/master/README.md#developer-instructions



Backlinks: python:packaging python:windows-setup

CC0 / Public domain dedication To the extent possible under law, d3vid seaward has waived all copyright and related or neighboring rights to "youtube-dl in Grasmere notebook, including code snippets" (why? how?)