Download videos from YouTube and other websites.

# To download a video or playlist:
youtube-dl https://www.youtube.com/watch?v=oHg5SJYRHA0

# To download the audio from a video and convert it to an MP3:
youtube-dl -x --audio-format mp3 url

# To download video(s) as MP4 files with custom filenames:
youtube-dl --format mp4 --output "%(title) by %(uploader) on %(upload_date) in %(playlist).%(ext)" url

# To download a video and save its description, metadata, annotations, subtitles, and thumbnail:
youtube-dl --write-description --write-info-json --write-annotations --write-sub --write-thumbnail url

# To from a playlist, download all "Let's Play" videos that aren't marked "NSFW" or age-restricted for 7 year-olds:
youtube-dl --match-title "let's play" --age-limit 7 --reject-title "nsfw" playlist_url

# To download a video in 720p MP4:
youtube-dl -f 22 example.com/watch?v=id

# To download a video in 720p MP4 or WebM or FLV:
youtube-dl -f 22/45/120

# To list all available formats of a video:
youtube-dl -F example.com/watch?v=id

# To download a video to /$uploader/$date/$title.$ext:
youtube-dl -o '%(uploader)s/%(date)s/%(title)s.%(ext)s' example.com/watch?v=id

# To download a video playlist starting from a certain video:
youtube-dl --playlist-start 5 example.com/watch?v=id&list=listid

# To simulate a download with youtube-dl:
youtube-dl -s example.com/watch?v=id

# For all video formats see
# http://en.wikipedia.org/wiki/YouTube#Quality_and_codecs