1 youtube-dl - download videos from youtube.com or other video platforms
 
  10 -   DEVELOPER INSTRUCTIONS
 
  17 To install it right away for all UNIX users (Linux, OS X, etc.), type:
 
  19     sudo curl https://yt-dl.org/latest/youtube-dl -o /usr/local/bin/youtube-dl
 
  20     sudo chmod a+x /usr/local/bin/youtube-dl
 
  22 If you do not have curl, you can alternatively use a recent wget:
 
  24     sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
 
  25     sudo chmod a+x /usr/local/bin/youtube-dl
 
  27 Windows users can download a .exe file and place it in their home
 
  28 directory or any other location on their PATH.
 
  30 OS X users can install youtube-dl with Homebrew.
 
  32     brew install youtube-dl
 
  36     sudo pip install youtube-dl
 
  38 Alternatively, refer to the developer instructions below for how to
 
  39 check out and work with the git repository. For further options,
 
  40 including PGP signatures, see
 
  41 https://rg3.github.io/youtube-dl/download.html .
 
  46 youtube-dl is a small command-line program to download videos from
 
  47 YouTube.com and a few more sites. It requires the Python interpreter,
 
  48 version 2.6, 2.7, or 3.2+, and it is not platform specific. It should
 
  49 work on your Unix box, on Windows or on Mac OS X. It is released to the
 
  50 public domain, which means you can modify it, redistribute it or use it
 
  53     youtube-dl [OPTIONS] URL [URL...]
 
  58     -h, --help                       print this help text and exit
 
  59     --version                        print program version and exit
 
  60     -U, --update                     update this program to latest version. Make
 
  61                                      sure that you have sufficient permissions
 
  62                                      (run with sudo if needed)
 
  63     -i, --ignore-errors              continue on download errors, for example to
 
  64                                      skip unavailable videos in a playlist
 
  65     --abort-on-error                 Abort downloading of further videos (in the
 
  66                                      playlist or the command line) if an error
 
  68     --dump-user-agent                display the current browser identification
 
  69     --list-extractors                List all supported extractors and the URLs
 
  71     --extractor-descriptions         Output descriptions of all supported
 
  73     --default-search PREFIX          Use this prefix for unqualified URLs. For
 
  74                                      example "gvsearch2:" downloads two videos
 
  75                                      from google videos for  youtube-dl "large
 
  76                                      apple". Use the value "auto" to let
 
  77                                      youtube-dl guess ("auto_warning" to emit a
 
  78                                      warning when guessing). "error" just throws
 
  79                                      an error. The default value "fixup_error"
 
  80                                      repairs broken URLs, but emits an error if
 
  81                                      this is not possible instead of searching.
 
  82     --ignore-config                  Do not read configuration files. When given
 
  83                                      in the global configuration file /etc
 
  84                                      /youtube-dl.conf: Do not read the user
 
  85                                      configuration in ~/.config/youtube-
 
  86                                      dl/config (%APPDATA%/youtube-dl/config.txt
 
  88     --flat-playlist                  Do not extract the videos of a playlist,
 
  90     --no-color                       Do not emit color codes in output.
 
  95     --proxy URL                      Use the specified HTTP/HTTPS proxy. Pass in
 
  96                                      an empty string (--proxy "") for direct
 
  98     --socket-timeout SECONDS         Time to wait before giving up, in seconds
 
  99     --source-address IP              Client-side IP address to bind to
 
 101     -4, --force-ipv4                 Make all connections via IPv4
 
 103     -6, --force-ipv6                 Make all connections via IPv6
 
 109     --playlist-start NUMBER          playlist video to start at (default is 1)
 
 110     --playlist-end NUMBER            playlist video to end at (default is last)
 
 111     --playlist-items ITEM_SPEC       playlist video items to download. Specify
 
 112                                      indices of the videos in the playlist
 
 113                                      seperated by commas like: "--playlist-items
 
 114                                      1,2,5,8" if you want to download videos
 
 115                                      indexed 1, 2, 5, 8 in the playlist. You can
 
 116                                      specify range: "--playlist-items
 
 117                                      1-3,7,10-13", it will download the videos
 
 118                                      at index 1, 2, 3, 7, 10, 11, 12 and 13.
 
 119     --match-title REGEX              download only matching titles (regex or
 
 121     --reject-title REGEX             skip download for matching titles (regex or
 
 123     --max-downloads NUMBER           Abort after downloading NUMBER files
 
 124     --min-filesize SIZE              Do not download any videos smaller than
 
 125                                      SIZE (e.g. 50k or 44.6m)
 
 126     --max-filesize SIZE              Do not download any videos larger than SIZE
 
 128     --date DATE                      download only videos uploaded in this date
 
 129     --datebefore DATE                download only videos uploaded on or before
 
 130                                      this date (i.e. inclusive)
 
 131     --dateafter DATE                 download only videos uploaded on or after
 
 132                                      this date (i.e. inclusive)
 
 133     --min-views COUNT                Do not download any videos with less than
 
 135     --max-views COUNT                Do not download any videos with more than
 
 137     --match-filter FILTER            (Experimental) Generic video filter.
 
 138                                      Specify any key (see help for -o for a list
 
 139                                      of available keys) to match if the key is
 
 140                                      present, !key to check if the key is not
 
 141                                      present,key > NUMBER (like "comment_count >
 
 142                                      12", also works with >=, <, <=, !=, =) to
 
 143                                      compare against a number, and & to require
 
 144                                      multiple matches. Values which are not
 
 145                                      known are excluded unless you put a
 
 146                                      question mark (?) after the operator.For
 
 147                                      example, to only match videos that have
 
 148                                      been liked more than 100 times and disliked
 
 149                                      less than 50 times (or the dislike
 
 150                                      functionality is not available at the given
 
 151                                      service), but who also have a description,
 
 152                                      use  --match-filter "like_count > 100 &
 
 153                                      dislike_count <? 50 & description" .
 
 154     --no-playlist                    If the URL refers to a video and a
 
 155                                      playlist, download only the video.
 
 156     --yes-playlist                   If the URL refers to a video and a
 
 157                                      playlist, download the playlist.
 
 158     --age-limit YEARS                download only videos suitable for the given
 
 160     --download-archive FILE          Download only videos not listed in the
 
 161                                      archive file. Record the IDs of all
 
 162                                      downloaded videos in it.
 
 163     --include-ads                    Download advertisements as well
 
 169     -r, --rate-limit LIMIT           maximum download rate in bytes per second
 
 171     -R, --retries RETRIES            number of retries (default is 10), or
 
 173     --buffer-size SIZE               size of download buffer (e.g. 1024 or 16K)
 
 175     --no-resize-buffer               do not automatically adjust the buffer
 
 176                                      size. By default, the buffer size is
 
 177                                      automatically resized from an initial value
 
 179     --playlist-reverse               Download playlist videos in reverse order
 
 180     --xattr-set-filesize             (experimental) set file xattribute
 
 181                                      ytdl.filesize with expected filesize
 
 182     --hls-prefer-native              (experimental) Use the native HLS
 
 183                                      downloader instead of ffmpeg.
 
 184     --external-downloader COMMAND    (experimental) Use the specified external
 
 185                                      downloader. Currently supports
 
 191     -a, --batch-file FILE            file containing URLs to download ('-' for
 
 193     --id                             use only video ID in file name
 
 194     -o, --output TEMPLATE            output filename template. Use %(title)s to
 
 195                                      get the title, %(uploader)s for the
 
 196                                      uploader name, %(uploader_id)s for the
 
 197                                      uploader nickname if different,
 
 198                                      %(autonumber)s to get an automatically
 
 199                                      incremented number, %(ext)s for the
 
 200                                      filename extension, %(format)s for the
 
 201                                      format description (like "22 - 1280x720" or
 
 202                                      "HD"), %(format_id)s for the unique id of
 
 203                                      the format (like Youtube's itags: "137"),
 
 204                                      %(upload_date)s for the upload date
 
 205                                      (YYYYMMDD), %(extractor)s for the provider
 
 206                                      (youtube, metacafe, etc), %(id)s for the
 
 207                                      video id, %(playlist_title)s,
 
 208                                      %(playlist_id)s, or %(playlist)s (=title if
 
 209                                      present, ID otherwise) for the playlist the
 
 210                                      video is in, %(playlist_index)s for the
 
 211                                      position in the playlist. %(height)s and
 
 212                                      %(width)s for the width and height of the
 
 213                                      video format. %(resolution)s for a textual
 
 214                                      description of the resolution of the video
 
 215                                      format. %% for a literal percent. Use - to
 
 216                                      output to stdout. Can also be used to
 
 217                                      download to a different directory, for
 
 218                                      example with -o '/my/downloads/%(uploader)s
 
 219                                      /%(title)s-%(id)s.%(ext)s' .
 
 220     --autonumber-size NUMBER         Specifies the number of digits in
 
 221                                      %(autonumber)s when it is present in output
 
 222                                      filename template or --auto-number option
 
 224     --restrict-filenames             Restrict filenames to only ASCII
 
 225                                      characters, and avoid "&" and spaces in
 
 227     -A, --auto-number                [deprecated; use  -o
 
 228                                      "%(autonumber)s-%(title)s.%(ext)s" ] number
 
 229                                      downloaded files starting from 00000
 
 230     -t, --title                      [deprecated] use title in file name
 
 232     -l, --literal                    [deprecated] alias of --title
 
 233     -w, --no-overwrites              do not overwrite files
 
 234     -c, --continue                   force resume of partially downloaded files.
 
 235                                      By default, youtube-dl will resume
 
 236                                      downloads if possible.
 
 237     --no-continue                    do not resume partially downloaded files
 
 238                                      (restart from beginning)
 
 239     --no-part                        do not use .part files - write directly
 
 241     --no-mtime                       do not use the Last-modified header to set
 
 242                                      the file modification time
 
 243     --write-description              write video description to a .description
 
 245     --write-info-json                write video metadata to a .info.json file
 
 246     --write-annotations              write video annotations to a .annotation
 
 248     --load-info FILE                 json file containing the video information
 
 249                                      (created with the "--write-json" option)
 
 250     --cookies FILE                   file to read cookies from and dump cookie
 
 252     --cache-dir DIR                  Location in the filesystem where youtube-dl
 
 253                                      can store some downloaded information
 
 254                                      permanently. By default $XDG_CACHE_HOME
 
 255                                      /youtube-dl or ~/.cache/youtube-dl . At the
 
 256                                      moment, only YouTube player files (for
 
 257                                      videos with obfuscated signatures) are
 
 258                                      cached, but that may change.
 
 259     --no-cache-dir                   Disable filesystem caching
 
 260     --rm-cache-dir                   Delete all filesystem cache files
 
 265     --write-thumbnail                write thumbnail image to disk
 
 266     --write-all-thumbnails           write all thumbnail image formats to disk
 
 267     --list-thumbnails                Simulate and list all available thumbnail
 
 270 Verbosity / Simulation Options:
 
 271 -------------------------------
 
 273     -q, --quiet                      activates quiet mode
 
 274     --no-warnings                    Ignore warnings
 
 275     -s, --simulate                   do not download the video and do not write
 
 277     --skip-download                  do not download the video
 
 278     -g, --get-url                    simulate, quiet but print URL
 
 279     -e, --get-title                  simulate, quiet but print title
 
 280     --get-id                         simulate, quiet but print id
 
 281     --get-thumbnail                  simulate, quiet but print thumbnail URL
 
 282     --get-description                simulate, quiet but print video description
 
 283     --get-duration                   simulate, quiet but print video length
 
 284     --get-filename                   simulate, quiet but print output filename
 
 285     --get-format                     simulate, quiet but print output format
 
 286     -j, --dump-json                  simulate, quiet but print JSON information.
 
 287                                      See --output for a description of available
 
 289     -J, --dump-single-json           simulate, quiet but print JSON information
 
 290                                      for each command-line argument. If the URL
 
 291                                      refers to a playlist, dump the whole
 
 292                                      playlist information in a single line.
 
 293     --print-json                     Be quiet and print the video information as
 
 294                                      JSON (video is still being downloaded).
 
 295     --newline                        output progress bar as new lines
 
 296     --no-progress                    do not print progress bar
 
 297     --console-title                  display progress in console titlebar
 
 298     -v, --verbose                    print various debugging information
 
 299     --dump-intermediate-pages        print downloaded pages to debug problems
 
 301     --write-pages                    Write downloaded intermediary pages to
 
 302                                      files in the current directory to debug
 
 304     --print-traffic                  Display sent and read HTTP traffic
 
 305     -C, --call-home                  Contact the youtube-dl server for
 
 307     --no-call-home                   Do NOT contact the youtube-dl server for
 
 313     --encoding ENCODING              Force the specified encoding (experimental)
 
 314     --no-check-certificate           Suppress HTTPS certificate validation.
 
 315     --prefer-insecure                Use an unencrypted connection to retrieve
 
 316                                      information about the video. (Currently
 
 317                                      supported only for YouTube)
 
 318     --user-agent UA                  specify a custom user agent
 
 319     --referer URL                    specify a custom referer, use if the video
 
 320                                      access is restricted to one domain
 
 321     --add-header FIELD:VALUE         specify a custom HTTP header and its value,
 
 322                                      separated by a colon ':'. You can use this
 
 323                                      option multiple times
 
 324     --bidi-workaround                Work around terminals that lack
 
 325                                      bidirectional text support. Requires bidiv
 
 326                                      or fribidi executable in PATH
 
 327     --sleep-interval SECONDS         Number of seconds to sleep before each
 
 330 Video Format Options:
 
 331 ---------------------
 
 333     -f, --format FORMAT              video format code, specify the order of
 
 334                                      preference using slashes, as in -f 22/17/18
 
 335                                      .  Instead of format codes, you can select
 
 336                                      by extension for the extensions aac, m4a,
 
 337                                      mp3, mp4, ogg, wav, webm. You can also use
 
 338                                      the special names "best", "bestvideo",
 
 339                                      "bestaudio", "worst".  You can filter the
 
 340                                      video results by putting a condition in
 
 341                                      brackets, as in -f "best[height=720]" (or
 
 342                                      -f "[filesize>10M]").  This works for
 
 343                                      filesize, height, width, tbr, abr, vbr,
 
 344                                      asr, and fps and the comparisons <, <=, >,
 
 345                                      >=, =, != and for ext, acodec, vcodec,
 
 346                                      container, and protocol and the comparisons
 
 347                                      =, != . Formats for which the value is not
 
 348                                      known are excluded unless you put a
 
 349                                      question mark (?) after the operator. You
 
 350                                      can combine format filters, so  -f "[height
 
 351                                      <=? 720][tbr>500]" selects up to 720p
 
 352                                      videos (or videos where the height is not
 
 353                                      known) with a bitrate of at least 500
 
 354                                      KBit/s. By default, youtube-dl will pick
 
 355                                      the best quality. Use commas to download
 
 356                                      multiple audio formats, such as -f
 
 357                                      136/137/mp4/bestvideo,140/m4a/bestaudio.
 
 358                                      You can merge the video and audio of two
 
 359                                      formats into a single file using -f <video-
 
 360                                      format>+<audio-format> (requires ffmpeg or
 
 361                                      avconv), for example -f
 
 363     --all-formats                    download all available video formats
 
 364     --prefer-free-formats            prefer free video formats unless a specific
 
 366     --max-quality FORMAT             highest quality format to download
 
 367     -F, --list-formats               list all available formats
 
 368     --youtube-skip-dash-manifest     Do not download the DASH manifest on
 
 370     --merge-output-format FORMAT     If a merge is required (e.g.
 
 371                                      bestvideo+bestaudio), output to given
 
 372                                      container format. One of mkv, mp4, ogg,
 
 373                                      webm, flv.Ignored if no merge is required
 
 378     --write-sub                      write subtitle file
 
 379     --write-auto-sub                 write automatic subtitle file (youtube
 
 381     --all-subs                       downloads all the available subtitles of
 
 383     --list-subs                      lists all available subtitles for the video
 
 384     --sub-format FORMAT              subtitle format, accepts formats
 
 385                                      preference, for example: "ass/srt/best"
 
 386     --sub-lang LANGS                 languages of the subtitles to download
 
 387                                      (optional) separated by commas, use IETF
 
 388                                      language tags like 'en,pt'
 
 390 Authentication Options:
 
 391 -----------------------
 
 393     -u, --username USERNAME          login with this account ID
 
 394     -p, --password PASSWORD          account password. If this option is left
 
 395                                      out, youtube-dl will ask interactively.
 
 396     -2, --twofactor TWOFACTOR        two-factor auth code
 
 397     -n, --netrc                      use .netrc authentication data
 
 398     --video-password PASSWORD        video password (vimeo, smotri)
 
 400 Post-processing Options:
 
 401 ------------------------
 
 403     -x, --extract-audio              convert video files to audio-only files
 
 404                                      (requires ffmpeg or avconv and ffprobe or
 
 406     --audio-format FORMAT            "best", "aac", "vorbis", "mp3", "m4a",
 
 407                                      "opus", or "wav"; "best" by default
 
 408     --audio-quality QUALITY          ffmpeg/avconv audio quality specification,
 
 409                                      insert a value between 0 (better) and 9
 
 410                                      (worse) for VBR or a specific bitrate like
 
 412     --recode-video FORMAT            Encode the video to another format if
 
 413                                      necessary (currently supported:
 
 414                                      mp4|flv|ogg|webm|mkv)
 
 415     -k, --keep-video                 keeps the video file on disk after the
 
 416                                      post-processing; the video is erased by
 
 418     --no-post-overwrites             do not overwrite post-processed files; the
 
 419                                      post-processed files are overwritten by
 
 421     --embed-subs                     embed subtitles in the video (only for mp4
 
 423     --embed-thumbnail                embed thumbnail in the audio as cover art
 
 424     --add-metadata                   write metadata to the video file
 
 425     --xattrs                         write metadata to the video file's xattrs
 
 426                                      (using dublin core and xdg standards)
 
 427     --fixup POLICY                   Automatically correct known faults of the
 
 428                                      file. One of never (do nothing), warn (only
 
 429                                      emit a warning), detect_or_warn(the
 
 430                                      default; fix file if we can, warn
 
 432     --prefer-avconv                  Prefer avconv over ffmpeg for running the
 
 433                                      postprocessors (default)
 
 434     --prefer-ffmpeg                  Prefer ffmpeg over avconv for running the
 
 436     --ffmpeg-location PATH           Location of the ffmpeg/avconv binary;
 
 437                                      either the path to the binary or its
 
 438                                      containing directory.
 
 439     --exec CMD                       Execute a command on the file after
 
 440                                      downloading, similar to find's -exec
 
 441                                      syntax. Example: --exec 'adb push {}
 
 442                                      /sdcard/Music/ && rm {}'
 
 443     --convert-subtitles FORMAT       Convert the subtitles to other format
 
 444                                      (currently supported: srt|ass|vtt)
 
 449 You can configure youtube-dl by placing default arguments (such as
 
 450 --extract-audio --no-mtime to always extract the audio and not copy the
 
 451 mtime) into /etc/youtube-dl.conf and/or ~/.config/youtube-dl/config. On
 
 452 Windows, the configuration file locations are
 
 453 %APPDATA%\youtube-dl\config.txt and
 
 454 C:\Users\<user name>\youtube-dl.conf.
 
 459 The -o option allows users to indicate a template for the output file
 
 460 names. The basic usage is not to set any template arguments when
 
 461 downloading a single file, like in
 
 462 youtube-dl -o funny_video.flv "http://some/video". However, it may
 
 463 contain special sequences that will be replaced when downloading each
 
 464 video. The special sequences have the format %(NAME)s. To clarify, that
 
 465 is a percent symbol followed by a name in parenthesis, followed by a
 
 466 lowercase S. Allowed names are:
 
 468 -   id: The sequence will be replaced by the video identifier.
 
 469 -   url: The sequence will be replaced by the video URL.
 
 470 -   uploader: The sequence will be replaced by the nickname of the
 
 471     person who uploaded the video.
 
 472 -   upload_date: The sequence will be replaced by the upload date in
 
 474 -   title: The sequence will be replaced by the video title.
 
 475 -   ext: The sequence will be replaced by the appropriate extension
 
 477 -   epoch: The sequence will be replaced by the Unix epoch when creating
 
 479 -   autonumber: The sequence will be replaced by a five-digit number
 
 480     that will be increased with each download, starting at zero.
 
 481 -   playlist: The name or the id of the playlist that contains the
 
 483 -   playlist_index: The index of the video in the playlist, a five-digit
 
 486 The current default template is %(title)s-%(id)s.%(ext)s.
 
 488 In some cases, you don't want special characters such as äø, spaces, or
 
 489 &, such as when transferring the downloaded filename to a Windows system
 
 490 or the filename through an 8bit-unsafe channel. In these cases, add the
 
 491 --restrict-filenames flag to get a shorter title:
 
 494 $ youtube-dl --get-filename -o "%(title)s.%(ext)s" BaW_jenozKc
 
 495 youtube-dl test video ''_Ƥāš.mp4    # All kinds of weird characters
 
 496 $ youtube-dl --get-filename -o "%(title)s.%(ext)s" BaW_jenozKc --restrict-filenames
 
 497 youtube-dl_test_video_.mp4          # A simple file name
 
 503 Videos can be filtered by their upload date using the options --date,
 
 504 --datebefore or --dateafter, they accept dates in two formats:
 
 506 -   Absolute dates: Dates in the format YYYYMMDD.
 
 507 -   Relative dates: Dates in the format
 
 508     (now|today)[+-][0-9](day|week|month|year)(s)?
 
 513 # Download only the videos uploaded in the last 6 months
 
 514 $ youtube-dl --dateafter now-6months
 
 516 # Download only the videos uploaded on January 1, 1970
 
 517 $ youtube-dl --date 19700101
 
 519 $ # will only download the videos uploaded in the 200x decade
 
 520 $ youtube-dl --dateafter 20000101 --datebefore 20091231
 
 526 How do I update youtube-dl?
 
 528 If you've followed our manual installation instructions, you can simply
 
 529 run youtube-dl -U (or, on Linux, sudo youtube-dl -U).
 
 531 If you have used pip, a simple sudo pip install -U youtube-dl is
 
 532 sufficient to update.
 
 534 If you have installed youtube-dl using a package manager like apt-get or
 
 535 yum, use the standard system update mechanism to update. Note that
 
 536 distribution packages are often outdated. As a rule of thumb, youtube-dl
 
 537 releases at least once a month, and often weekly or even daily. Simply
 
 538 go to http://yt-dl.org/ to find out the current version. Unfortunately,
 
 539 there is nothing we youtube-dl developers can do if your distributions
 
 540 serves a really outdated version. You can (and should) complain to your
 
 541 distribution in their bugtracker or support forum.
 
 543 As a last resort, you can also uninstall the version installed by your
 
 544 package manager and follow our manual installation instructions. For
 
 545 that, remove the distribution's package, with a line like
 
 547     sudo apt-get remove -y youtube-dl
 
 549 Afterwards, simply follow our manual installation instructions:
 
 551     sudo wget https://yt-dl.org/latest/youtube-dl -O /usr/local/bin/youtube-dl
 
 552     sudo chmod a+x /usr/local/bin/youtube-dl
 
 555 Again, from then on you'll be able to update with sudo youtube-dl -U.
 
 557 I'm getting an error Unable to extract OpenGraph title on YouTube playlists
 
 559 YouTube changed their playlist format in March 2014 and later on, so
 
 560 you'll need at least youtube-dl 2014.07.25 to download all YouTube
 
 563 If you have installed youtube-dl with a package manager, pip, setup.py
 
 564 or a tarball, please use that to update. Note that Ubuntu packages do
 
 565 not seem to get updated anymore. Since we are not affiliated with
 
 566 Ubuntu, there is little we can do. Feel free to report bugs to the
 
 567 Ubuntu packaging guys - all they have to do is update the package to a
 
 568 somewhat recent version. See above for a way to update.
 
 570 Do I always have to pass in --max-quality FORMAT, or -citw?
 
 572 By default, youtube-dl intends to have the best options (incidentally,
 
 573 if you have a convincing case that these should be different, please
 
 574 file an issue where you explain that). Therefore, it is unnecessary and
 
 575 sometimes harmful to copy long option strings from webpages. In
 
 576 particular, --max-quality limits the video quality (so if you want the
 
 577 best quality, do NOT pass it in), and the only option out of -citw that
 
 578 is regularly useful is -i.
 
 580 Can you please put the -b option back?
 
 582 Most people asking this question are not aware that youtube-dl now
 
 583 defaults to downloading the highest available quality as reported by
 
 584 YouTube, which will be 1080p or 720p in some cases, so you no longer
 
 585 need the -b option. For some specific videos, maybe YouTube does not
 
 586 report them to be available in a specific high quality format you're
 
 587 interested in. In that case, simply request it with the -f option and
 
 588 youtube-dl will try to download it.
 
 590 I get HTTP error 402 when trying to download a video. What's this?
 
 592 Apparently YouTube requires you to pass a CAPTCHA test if you download
 
 593 too much. We're considering to provide a way to let you solve the
 
 594 CAPTCHA, but at the moment, your best course of action is pointing a
 
 595 webbrowser to the youtube URL, solving the CAPTCHA, and restart
 
 598 I have downloaded a video but how can I play it?
 
 600 Once the video is fully downloaded, use any video player, such as vlc or
 
 603 I extracted a video URL with -g, but it does not play on another machine / in my webbrowser.
 
 605 It depends a lot on the service. In many cases, requests for the video
 
 606 (to download/play it) must come from the same IP address and with the
 
 607 same cookies. Use the --cookies option to write the required cookies
 
 608 into a file, and advise your downloader to read cookies from that file.
 
 609 Some sites also require a common user agent to be used, use
 
 610 --dump-user-agent to see the one in use by youtube-dl.
 
 612 It may be beneficial to use IPv6; in some cases, the restrictions are
 
 613 only applied to IPv4. Some services (sometimes only for a subset of
 
 614 videos) do not restrict the video URL by IP address, cookie, or
 
 615 user-agent, but these are the exception rather than the rule.
 
 617 Please bear in mind that some URL protocols are not supported by
 
 618 browsers out of the box, including RTMP. If you are using -g, your own
 
 619 downloader must support these as well.
 
 621 If you want to play the video on a machine that is not running
 
 622 youtube-dl, you can relay the video content from the machine that runs
 
 623 youtube-dl. You can use -o - to let youtube-dl stream a video to stdout,
 
 624 or simply allow the player to download the files written by youtube-dl
 
 627 ERROR: no fmt_url_map or conn information found in video info
 
 629 YouTube has switched to a new video info format in July 2011 which is
 
 630 not supported by old versions of youtube-dl. See above for how to update
 
 633 ERROR: unable to download video
 
 635 YouTube requires an additional signature since September 2012 which is
 
 636 not supported by old versions of youtube-dl. See above for how to update
 
 639 ExtractorError: Could not find JS function u'OF'
 
 641 In February 2015, the new YouTube player contained a character sequence
 
 642 in a string that was misinterpreted by old versions of youtube-dl. See
 
 643 above for how to update youtube-dl.
 
 645 SyntaxError: Non-ASCII character
 
 649     File "youtube-dl", line 2
 
 650     SyntaxError: Non-ASCII character '\x93' ...
 
 652 means you're using an outdated version of Python. Please update to
 
 655 What is this binary file? Where has the code gone?
 
 657 Since June 2012 (#342) youtube-dl is packed as an executable zipfile,
 
 658 simply unzip it (might need renaming to youtube-dl.zip first on some
 
 659 systems) or clone the git repository, as laid out above. If you modify
 
 660 the code, you can run it by executing the __main__.py file. To recompile
 
 661 the executable, run make youtube-dl.
 
 663 The exe throws a Runtime error from Visual C++
 
 665 To run the exe you need to install first the Microsoft Visual C++ 2008
 
 666 Redistributable Package.
 
 668 On Windows, how should I set up ffmpeg and youtube-dl? Where should I put the exe files?
 
 670 If you put youtube-dl and ffmpeg in the same directory that you're
 
 671 running the command from, it will work, but that's rather cumbersome.
 
 673 To make a different directory work - either for ffmpeg, or for
 
 674 youtube-dl, or for both - simply create the directory (say, C:\bin, or
 
 675 C:\Users\<User name>\bin), put all the executables directly in there,
 
 676 and then set your PATH environment variable to include that directory.
 
 678 From then on, after restarting your shell, you will be able to access
 
 679 both youtube-dl and ffmpeg (and youtube-dl will be able to find ffmpeg)
 
 680 by simply typing youtube-dl or ffmpeg, no matter what directory you're
 
 683 How do I put downloads into a specific folder?
 
 685 Use the -o to specify an output template, for example
 
 686 -o "/home/user/videos/%(title)s-%(id)s.%(ext)s". If you want this for
 
 687 all of your downloads, put the option into your configuration file.
 
 689 How do I download a video starting with a - ?
 
 691 Either prepend http://www.youtube.com/watch?v= or separate the ID from
 
 694     youtube-dl -- -wNyEUrxzFU
 
 695     youtube-dl "http://www.youtube.com/watch?v=-wNyEUrxzFU"
 
 697 Can you add support for this anime video site, or site which shows current movies for free?
 
 699 As a matter of policy (as well as legality), youtube-dl does not include
 
 700 support for services that specialize in infringing copyright. As a rule
 
 701 of thumb, if you cannot easily find a video that the service is quite
 
 702 obviously allowed to distribute (i.e. that has been uploaded by the
 
 703 creator, the creator's distributor, or is published under a free
 
 704 license), the service is probably unfit for inclusion to youtube-dl.
 
 706 A note on the service that they don't host the infringing content, but
 
 707 just link to those who do, is evidence that the service should not be
 
 708 included into youtube-dl. The same goes for any DMCA note when the whole
 
 709 front page of the service is filled with videos they are not allowed to
 
 710 distribute. A "fair use" note is equally unconvincing if the service
 
 711 shows copyright-protected videos in full without authorization.
 
 713 Support requests for services that do purchase the rights to distribute
 
 714 their content are perfectly fine though. If in doubt, you can simply
 
 715 include a source that mentions the legitimate purchase of content.
 
 717 How can I detect whether a given URL is supported by youtube-dl?
 
 719 For one, have a look at the list of supported sites. Note that it can
 
 720 sometimes happen that the site changes its URL scheme (say, from
 
 721 http://example.com/video/1234567 to http://example.com/v/1234567 ) and
 
 722 youtube-dl reports an URL of a service in that list as unsupported. In
 
 723 that case, simply report a bug.
 
 725 It is not possible to detect whether a URL is supported or not. That's
 
 726 because youtube-dl contains a generic extractor which matches all URLs.
 
 727 You may be tempted to disable, exclude, or remove the generic extractor,
 
 728 but the generic extractor not only allows users to extract videos from
 
 729 lots of websites that embed a video from another service, but may also
 
 730 be used to extract video from a service that it's hosting itself.
 
 731 Therefore, we neither recommend nor support disabling, excluding, or
 
 732 removing the generic extractor.
 
 734 If you want to find out whether a given URL is supported, simply call
 
 735 youtube-dl with it. If you get no videos back, chances are the URL is
 
 736 either not referring to a video or unsupported. You can find out which
 
 737 by examining the output (if you run youtube-dl on the console) or
 
 738 catching an UnsupportedError exception if you run it from a Python
 
 741 DEVELOPER INSTRUCTIONS
 
 742 ======================
 
 744 Most users do not need to build youtube-dl and can download the builds
 
 745 or get them from their distribution.
 
 747 To run youtube-dl as a developer, you don't need to build anything
 
 748 either. Simply execute
 
 752 To run the test, simply invoke your favorite test runner, or execute a
 
 753 test file directly; any of the following work:
 
 755     python -m unittest discover
 
 756     python test/test_download.py
 
 759 If you want to create a build of youtube-dl yourself, you'll need
 
 767 Adding support for a new site
 
 769 If you want to add support for a new site, you can follow this quick
 
 770 list (assuming your service is called yourextractor):
 
 772 1.  Fork this repository
 
 773 2.  Check out the source code with
 
 774     git clone git@github.com:YOUR_GITHUB_USERNAME/youtube-dl.git
 
 775 3.  Start a new git branch with
 
 776     cd youtube-dl; git checkout -b yourextractor
 
 777 4.  Start with this simple template and save it to
 
 778     youtube_dl/extractor/yourextractor.py:
 
 782     from __future__ import unicode_literals
 
 784     from .common import InfoExtractor
 
 787     class YourExtractorIE(InfoExtractor):
 
 788         _VALID_URL = r'https?://(?:www\.)?yourextractor\.com/watch/(?P<id>[0-9]+)'
 
 790             'url': 'http://yourextractor.com/watch/42',
 
 791             'md5': 'TODO: md5 sum of the first 10241 bytes of the video file (use --test)',
 
 795                 'title': 'Video title goes here',
 
 796                 'thumbnail': 're:^https?://.*\.jpg$',
 
 797                 # TODO more properties, either as:
 
 799                 # * MD5 checksum; start the string with md5:
 
 800                 # * A regular expression; start the string with re:
 
 801                 # * Any Python type (for example int or float)
 
 805         def _real_extract(self, url):
 
 806             video_id = self._match_id(url)
 
 807             webpage = self._download_webpage(url, video_id)
 
 809             # TODO more code goes here, for example ...
 
 810             title = self._html_search_regex(r'<h1>(.*?)</h1>', webpage, 'title')
 
 815                 'description': self._og_search_description(webpage),
 
 816                 # TODO more properties (see youtube_dl/extractor/common.py)
 
 820 5.  Add an import in youtube_dl/extractor/__init__.py.
 
 821 6.  Run python test/test_download.py TestDownload.test_YourExtractor.
 
 822     This should fail at first, but you can continually re-run it until
 
 823     you're done. If you decide to add more than one test, then rename
 
 824     _TEST to _TESTS and make it into a list of dictionaries. The tests
 
 825     will be then be named TestDownload.test_YourExtractor,
 
 826     TestDownload.test_YourExtractor_1,
 
 827     TestDownload.test_YourExtractor_2, etc.
 
 828 7.  Have a look at youtube_dl/common/extractor/common.py for possible
 
 829     helper methods and a detailed description of what your extractor
 
 830     should return. Add tests and code for as many as you want.
 
 831 8.  If you can, check the code with flake8.
 
 832 9.  When the tests pass, add the new files and commit them and push the
 
 835         $ git add youtube_dl/extractor/__init__.py
 
 836         $ git add youtube_dl/extractor/yourextractor.py
 
 837         $ git commit -m '[yourextractor] Add new extractor'
 
 838         $ git push origin yourextractor
 
 840 10. Finally, create a pull request. We'll then review and merge it.
 
 842 In any case, thank you very much for your contributions!
 
 847 youtube-dl makes the best effort to be a good command-line program, and
 
 848 thus should be callable from any programming language. If you encounter
 
 849 any problems parsing its output, feel free to create a report.
 
 851 From a Python program, you can embed youtube-dl in a more powerful
 
 858 with youtube_dl.YoutubeDL(ydl_opts) as ydl:
 
 859     ydl.download(['http://www.youtube.com/watch?v=BaW_jenozKc'])
 
 862 Most likely, you'll want to use various options. For a list of what can
 
 863 be done, have a look at youtube_dl/YoutubeDL.py. For a start, if you
 
 864 want to intercept youtube-dl's output, set a logger object.
 
 866 Here's a more complete example of a program that outputs only errors
 
 867 (and a short message after the download is finished), and
 
 868 downloads/converts the video to an mp3 file:
 
 874 class MyLogger(object):
 
 875     def debug(self, msg):
 
 878     def warning(self, msg):
 
 881     def error(self, msg):
 
 886     if d['status'] == 'finished':
 
 887         print('Done downloading, now converting ...')
 
 891     'format': 'bestaudio/best',
 
 893         'key': 'FFmpegExtractAudio',
 
 894         'preferredcodec': 'mp3',
 
 895         'preferredquality': '192',
 
 897     'logger': MyLogger(),
 
 898     'progress_hooks': [my_hook],
 
 900 with youtube_dl.YoutubeDL(ydl_opts) as ydl:
 
 901     ydl.download(['http://www.youtube.com/watch?v=BaW_jenozKc'])
 
 907 Bugs and suggestions should be reported at:
 
 908 https://github.com/rg3/youtube-dl/issues . Unless you were prompted so
 
 909 or there is another pertinent reason (e.g. GitHub fails to accept the
 
 910 bug report), please do not send bug reports via personal email. For
 
 911 discussions, join us in the irc channel #youtube-dl on freenode.
 
 913 Please include the full output of youtube-dl when run with -v.
 
 915 The output (including the first lines) contain important debugging
 
 916 information. Issues without the full output are often not reproducible
 
 917 and therefore do not get solved in short order, if ever.
 
 919 Please re-read your issue once again to avoid a couple of common
 
 920 mistakes (you can and should use this as a checklist):
 
 922 Is the description of the issue itself sufficient?
 
 924 We often get issue reports that we cannot really decipher. While in most
 
 925 cases we eventually get the required information after asking back
 
 926 multiple times, this poses an unnecessary drain on our resources. Many
 
 927 contributors, including myself, are also not native speakers, so we may
 
 930 So please elaborate on what feature you are requesting, or what bug you
 
 931 want to be fixed. Make sure that it's obvious
 
 933 -   What the problem is
 
 934 -   How it could be fixed
 
 935 -   How your proposed solution would look like
 
 937 If your report is shorter than two lines, it is almost certainly missing
 
 938 some of these, which makes it hard for us to respond to it. We're often
 
 939 too polite to close the issue outright, but the missing info makes
 
 940 misinterpretation likely. As a commiter myself, I often get frustrated
 
 941 by these issues, since the only possible way for me to move forward on
 
 942 them is to ask for clarification over and over.
 
 944 For bug reports, this means that your report should contain the complete
 
 945 output of youtube-dl when called with the -v flag. The error message you
 
 946 get for (most) bugs even says so, but you would not believe how many of
 
 947 our bug reports do not contain this information.
 
 949 Site support requests must contain an example URL. An example URL is a
 
 950 URL you might want to download, like
 
 951 http://www.youtube.com/watch?v=BaW_jenozKc . There should be an obvious
 
 952 video present. Except under very special circumstances, the main page of
 
 953 a video service (e.g. http://www.youtube.com/ ) is not an example URL.
 
 955 Are you using the latest version?
 
 957 Before reporting any issue, type youtube-dl -U. This should report that
 
 958 you're up-to-date. About 20% of the reports we receive are already
 
 959 fixed, but people are using outdated versions. This goes for feature
 
 962 Is the issue already documented?
 
 964 Make sure that someone has not already opened the issue you're trying to
 
 965 open. Search at the top of the window or at
 
 966 https://github.com/rg3/youtube-dl/search?type=Issues . If there is an
 
 967 issue, feel free to write something along the lines of "This affects me
 
 968 as well, with version 2015.01.01. Here is some more information on the
 
 969 issue: ...". While some issues may be old, a new post into them often
 
 970 spurs rapid activity.
 
 972 Why are existing options not enough?
 
 974 Before requesting a new feature, please have a quick peek at the list of
 
 975 supported options. Many feature requests are for features that actually
 
 976 exist already! Please, absolutely do show off your work in the issue
 
 977 report and detail how the existing similar options do not solve your
 
 980 Is there enough context in your bug report?
 
 982 People want to solve problems, and often think they do us a favor by
 
 983 breaking down their larger problems (e.g. wanting to skip already
 
 984 downloaded files) to a specific request (e.g. requesting us to look
 
 985 whether the file exists before downloading the info page). However, what
 
 986 often happens is that they break down the problem into two steps: One
 
 987 simple, and one impossible (or extremely complicated one).
 
 989 We are then presented with a very complicated request when the original
 
 990 problem could be solved far easier, e.g. by recording the downloaded
 
 991 video IDs in a separate file. To avoid this, you must include the
 
 992 greater context where it is non-obvious. In particular, every feature
 
 993 request that does not consist of adding support for a new site should
 
 994 contain a use case scenario that explains in what situation the missing
 
 995 feature would be useful.
 
 997 Does the issue involve one problem, and one problem only?
 
 999 Some of our users seem to think there is a limit of issues they can or
 
1000 should open. There is no limit of issues they can or should open. While
 
1001 it may seem appealing to be able to dump all your issues into one
 
1002 ticket, that means that someone who solves one of your issues cannot
 
1003 mark the issue as closed. Typically, reporting a bunch of issues leads
 
1004 to the ticket lingering since nobody wants to attack that behemoth,
 
1005 until someone mercifully splits the issue into multiple ones.
 
1007 In particular, every site support request issue should only pertain to
 
1008 services at one site (generally under a common domain, but always using
 
1009 the same backend technology). Do not request support for vimeo user
 
1010 videos, Whitehouse podcasts, and Google Plus pages in the same issue.
 
1011 Also, make sure that you don't post bug reports alongside feature
 
1012 requests. As a rule of thumb, a feature request does not include outputs
 
1013 of youtube-dl that are not immediately related to the feature at hand.
 
1014 Do not post reports of a network error alongside the request for a new
 
1017 Is anyone going to need the feature?
 
1019 Only post features that you (or an incapacitated friend you can
 
1020 personally talk to) require. Do not post features because they seem like
 
1021 a good idea. If they are really useful, they will be requested by
 
1022 someone who requires them.
 
1024 Is your question about youtube-dl?
 
1026 It may sound strange, but some bug reports we receive are completely
 
1027 unrelated to youtube-dl and relate to a different or even the reporter's
 
1028 own application. Please make sure that you are actually using
 
1029 youtube-dl. If you are using a UI for youtube-dl, report the bug to the
 
1030 maintainer of the actual application providing the UI. On the other
 
1031 hand, if your UI for youtube-dl fails in some way you believe is related
 
1032 to youtube-dl, by all means, go ahead and report the bug.
 
1037 youtube-dl is released into the public domain by the copyright holders.
 
1039 This README file was originally written by Daniel Bolton
 
1040 (https://github.com/dbbolton) and is likewise released into the public