Skip to content

using youtube-dl

Note

  • foo.bar represents the URL of the YouTube video to be downloaded.
  • bar.baz represents the URL of the YouTube playlist containing videos to be downloaded.

Use youtube-dl --all-subs --write-all-thumbnails --write-description --write-info-json -o "%(uploader)s's %(title)s-%(id)s.%(ext)s" foo.bar to download a YouTube video using a template-based filename, along with its description text, additional info, all available subtitles, and all available thumbnails.

alternatives

  • Add the -f "[height<=480]" option to download the video in the same way, but only in a format with a video height of 480 pixels or lower.
    • Add (%(resolution)s resolution) to the output template option to include information in the filename related to the video's resolution.
  • Change the output template option to -o "%(uploader)s's %(playlist)s-%(playlist_id)s %(playlist_index)s - %(title)s-%(id)s.%(ext)s" when downloading a playlist to include information in the filenames related to the video's playlist.
    • Change the output template option to -o "%(playlist_index)s - %(title)s-%(id)s.%(ext)s" for more compact filenames.
    • Add the --ignore-errors option to continue downloading even if download errors are encountered. This can be useful if one or more videos in the playlist are unavailable.
  • Add the --min-sleep-interval 10 --max-sleep-interval 60 option when downloading a playlist to sleep a random number of seconds, limited to between 10 and 60 seconds, before each individual download in the playlist. Be aware that this sleep also applies to non-video downloads, such as subtitles and thumbnail images.

explanation

Note

This is an incomplete explanation.

  • The -f "[height<=480]" format selection option downloads a video only in a format with a video height of 480 pixels or lower.
  • The -o "%(uploader)s's %(title)s (%(resolution)s resolution)-%(id)s.%(ext)s" output template option specifies a custom template for the name of the output file.
    • uploader specifies the video uploader's full name.
    • title specifies the video title.
    • resolution specifies the video resolution.
    • id specifies the video identifier.
    • ext specifies the video filename extension.
  • The --all-subs subtitle option downloads all available video subtitles.
  • The --ignore-errors option specifies that downloading should continue even if download errors are encountered.
  • The --min-sleep-interval 10 --max-sleep-interval 60 workaround option sleeps a random number of seconds, limited to between 10 and 60 seconds, before each individual download in a playlist. Be aware that this sleep also applies to non-video downloads, such as subtitles and thumbnail images.
  • The --write-all-thumbnails thumbnail image option writes all thumbnail image formats to disk.
  • The --write-description filesystem option writes the video description to a file with a .description extension.
  • The --write-info-json filesystem option writes video metadata to a file with a .info.json extension.

licensing

No rights reserved: CC0 1.0.