]> jfr.im git - yt-dlp.git/blame - README.md
Merge branch 'magenta' of https://github.com/adrianheine/youtube-dl into adrianheine...
[yt-dlp.git] / README.md
CommitLineData
424dc7be 1[![PyPi](https://img.shields.io/pypi/v/youtube-dlc.svg)](https://pypi.org/project/youtube-dlc)
c8598bbe 2[![Build Status](https://travis-ci.com/blackjack4494/youtube-dlc.svg?branch=master)](https://travis-ci.com/blackjack4494/youtube-dlc)
a90d4f7e 3[![Downloads](https://pepy.tech/badge/youtube-dlc)](https://pepy.tech/project/youtube-dlc)
5c0e5bc4 4
1c547dc8
TOH
5[![Gitter chat](https://badges.gitter.im/youtube-dlc/gitter.png)](https://gitter.im/youtube-dlc)
6[![License: Unlicense](https://img.shields.io/badge/license-Unlicense-blue.svg)](https://github.com/blackjack4494/youtube-dlc/blob/master/LICENSE)
7
9ab41610 8youtube-dlc - download videos from youtube.com or other video platforms
6bcd846b 9
b50e3bc6
PH
10- [INSTALLATION](#installation)
11- [DESCRIPTION](#description)
12- [OPTIONS](#options)
b50e3bc6 13- [COPYRIGHT](#copyright)
cfcec693 14
d19bb9c0
PH
15# INSTALLATION
16
5f326cf5
TOH
17**All Platforms**
18Preferred way using pip:
9ab41610 19You may want to use `python3` instead of `python`
d19bb9c0 20
9ab41610 21 python -m pip install --upgrade youtube-dlc
d19bb9c0 22
5f326cf5
TOH
23**UNIX** (Linux, macOS, etc.)
24Using wget:
25
26 sudo wget https://github.com/blackjack4494/youtube-dlc/releases/latest/download/youtube-dlc -O /usr/local/bin/youtube-dlc
27 sudo chmod a+rx /usr/local/bin/youtube-dlc
28
29Using curl:
30
31 sudo curl -L https://github.com/blackjack4494/youtube-dlc/releases/latest/download/youtube-dlc -o /usr/local/bin/youtube-dlc
32 sudo chmod a+rx /usr/local/bin/youtube-dlc
33
34
35**Windows** users can download [youtube-dlc.exe](https://github.com/blackjack4494/youtube-dlc/releases/latest/download/youtube-dlc.exe) (**do not** put in `C:\Windows\System32`!).
36
37**Compile**
38To build the Windows executable yourself
d19bb9c0 39
9ab41610 40 python -m pip install --upgrade pyinstaller
cefecac1 41 pyinstaller.exe youtube_dlc\__main__.py --onefile --name youtube-dlc
8f1aaa97 42
9ab41610 43Or simply execute the `make_win.bat` if pyinstaller is installed.
5f326cf5
TOH
44There will be a `youtube-dlc.exe` in `/dist`
45
46For Unix:
47You will need the required build tools
48python, make (GNU), pandoc, zip, nosetests
49Then simply type this
50
51 make
52
d19bb9c0 53
cfcec693 54# DESCRIPTION
9ab41610 55**youtube-dlc** is a command-line program to download videos from YouTube.com and a few more sites. It requires the Python interpreter, version 2.6, 2.7, or 3.2+, and it is not platform specific. It should work on your Unix box, on Windows or on macOS. It is released to the public domain, which means you can modify it, redistribute it or use it however you like.
6bcd846b 56
9ab41610 57 youtube-dlc [OPTIONS] URL [URL...]
b50e3bc6 58
cfcec693 59# OPTIONS
1dc2726f
PH
60 -h, --help Print this help text and exit
61 --version Print program version and exit
c4af7684
PH
62 -U, --update Update this program to latest version. Make
63 sure that you have sufficient permissions
64 (run with sudo if needed)
65 -i, --ignore-errors Continue on download errors, for example to
66 skip unavailable videos in a playlist
67 --abort-on-error Abort downloading of further videos (in the
68 playlist or the command line) if an error
69 occurs
1dc2726f 70 --dump-user-agent Display the current browser identification
4b9f9010 71 --list-extractors List all supported extractors
c4af7684
PH
72 --extractor-descriptions Output descriptions of all supported
73 extractors
74 --force-generic-extractor Force extraction to use the generic
75 extractor
76 --default-search PREFIX Use this prefix for unqualified URLs. For
77 example "gvsearch2:" downloads two videos
cefecac1 78 from google videos for youtube-dlc "large
c4af7684 79 apple". Use the value "auto" to let
cefecac1 80 youtube-dlc guess ("auto_warning" to emit a
c4af7684
PH
81 warning when guessing). "error" just throws
82 an error. The default value "fixup_error"
83 repairs broken URLs, but emits an error if
84 this is not possible instead of searching.
85 --ignore-config Do not read configuration files. When given
82674236 86 in the global configuration file
cefecac1 87 /etc/youtube-dlc.conf: Do not read the user
c4af7684 88 configuration in ~/.config/youtube-
e3671279
U
89 dlc/config (%APPDATA%/youtube-
90 dlc/config.txt on Windows)
dc48a354
S
91 --config-location PATH Location of the configuration file; either
92 the path to the config or its containing
93 directory.
c4af7684
PH
94 --flat-playlist Do not extract the videos of a playlist,
95 only list them.
bdf7f139
PH
96 --mark-watched Mark videos watched (YouTube only)
97 --no-mark-watched Do not mark videos watched (YouTube only)
1dc2726f 98 --no-color Do not emit color codes in output
08c1d0d3 99
149f05c7 100## Network Options:
28b4f736 101 --proxy URL Use the specified HTTP/HTTPS/SOCKS proxy.
0934c9d4
S
102 To enable SOCKS proxy, specify a proper
103 scheme. For example
28b4f736
PH
104 socks5://127.0.0.1:1080/. Pass in an empty
105 string (--proxy "") for direct connection
149f05c7 106 --socket-timeout SECONDS Time to wait before giving up, in seconds
c4af7684 107 --source-address IP Client-side IP address to bind to
c4af7684 108 -4, --force-ipv4 Make all connections via IPv4
c4af7684 109 -6, --force-ipv6 Make all connections via IPv6
8c6c88c7
S
110
111## Geo Restriction:
c25f1a9b
S
112 --geo-verification-proxy URL Use this proxy to verify the IP address for
113 some geo-restricted sites. The default
114 proxy specified by --proxy (or none, if the
7550ea50 115 option is not present) is used for the
4d2fdb07 116 actual downloading.
8c6c88c7 117 --geo-bypass Bypass geographic restriction via faking
0934c9d4 118 X-Forwarded-For HTTP header
8c6c88c7
S
119 --no-geo-bypass Do not bypass geographic restriction via
120 faking X-Forwarded-For HTTP header
8c6c88c7
S
121 --geo-bypass-country CODE Force bypass geographic restriction with
122 explicitly provided two-letter ISO 3166-2
0934c9d4 123 country code
9e18bb4c
S
124 --geo-bypass-ip-block IP_BLOCK Force bypass geographic restriction with
125 explicitly provided IP block in CIDR
0934c9d4 126 notation
149f05c7 127
cfcec693 128## Video Selection:
1dc2726f
PH
129 --playlist-start NUMBER Playlist video to start at (default is 1)
130 --playlist-end NUMBER Playlist video to end at (default is last)
c4af7684
PH
131 --playlist-items ITEM_SPEC Playlist video items to download. Specify
132 indices of the videos in the playlist
133 separated by commas like: "--playlist-items
134 1,2,5,8" if you want to download videos
135 indexed 1, 2, 5, 8 in the playlist. You can
136 specify range: "--playlist-items
137 1-3,7,10-13", it will download the videos
138 at index 1, 2, 3, 7, 10, 11, 12 and 13.
139 --match-title REGEX Download only matching titles (regex or
140 caseless sub-string)
141 --reject-title REGEX Skip download for matching titles (regex or
142 caseless sub-string)
780083db 143 --max-downloads NUMBER Abort after downloading NUMBER files
c4af7684
PH
144 --min-filesize SIZE Do not download any videos smaller than
145 SIZE (e.g. 50k or 44.6m)
146 --max-filesize SIZE Do not download any videos larger than SIZE
147 (e.g. 50k or 44.6m)
1dc2726f 148 --date DATE Download only videos uploaded in this date
c4af7684
PH
149 --datebefore DATE Download only videos uploaded on or before
150 this date (i.e. inclusive)
151 --dateafter DATE Download only videos uploaded on or after
152 this date (i.e. inclusive)
153 --min-views COUNT Do not download any videos with less than
154 COUNT views
155 --max-views COUNT Do not download any videos with more than
156 COUNT views
4d2fdb07 157 --match-filter FILTER Generic video filter. Specify any key (see
cb1e6d89
S
158 the "OUTPUT TEMPLATE" for a list of
159 available keys) to match if the key is
160 present, !key to check if the key is not
161 present, key > NUMBER (like "comment_count
162 > 12", also works with >=, <, <=, !=, =) to
163 compare against a number, key = 'LITERAL'
164 (like "uploader = 'Mike Smith'", also works
165 with !=) to match against a string literal
166 and & to require multiple matches. Values
167 which are not known are excluded unless you
168 put a question mark (?) after the operator.
169 For example, to only match videos that have
8c6c88c7
S
170 been liked more than 100 times and disliked
171 less than 50 times (or the dislike
172 functionality is not available at the given
173 service), but who also have a description,
174 use --match-filter "like_count > 100 &
175 dislike_count <? 50 & description" .
c4af7684
PH
176 --no-playlist Download only the video, if the URL refers
177 to a video and a playlist.
178 --yes-playlist Download the playlist, if the URL refers to
179 a video and a playlist.
180 --age-limit YEARS Download only videos suitable for the given
181 age
182 --download-archive FILE Download only videos not listed in the
183 archive file. Record the IDs of all
184 downloaded videos in it.
185 --include-ads Download advertisements as well
186 (experimental)
6bcd846b 187
d5a62e4f 188## Download Options:
5e3856a2 189 -r, --limit-rate RATE Maximum download rate in bytes per second
c4af7684
PH
190 (e.g. 50K or 4.2M)
191 -R, --retries RETRIES Number of retries (default is 10), or
192 "infinite".
0be8314d 193 --fragment-retries RETRIES Number of retries for a fragment (default
b56e41a7
S
194 is 10), or "infinite" (DASH, hlsnative and
195 ISM)
196 --skip-unavailable-fragments Skip unavailable fragments (DASH, hlsnative
197 and ISM)
4d2fdb07
S
198 --abort-on-unavailable-fragment Abort downloading when some fragment is not
199 available
a82f4184
S
200 --keep-fragments Keep downloaded fragments on disk after
201 downloading is finished; fragments are
202 erased by default
c4af7684
PH
203 --buffer-size SIZE Size of download buffer (e.g. 1024 or 16K)
204 (default is 1024)
205 --no-resize-buffer Do not automatically adjust the buffer
206 size. By default, the buffer size is
207 automatically resized from an initial value
208 of SIZE.
db157d2a
S
209 --http-chunk-size SIZE Size of a chunk for chunk-based HTTP
210 downloading (e.g. 10485760 or 10M) (default
211 is disabled). May be useful for bypassing
212 bandwidth throttling imposed by a webserver
213 (experimental)
2101f5d4 214 --playlist-reverse Download playlist videos in reverse order
31487eb9 215 --playlist-random Download playlist videos in random order
c4af7684 216 --xattr-set-filesize Set file xattribute ytdl.filesize with
0934c9d4 217 expected file size
c4af7684 218 --hls-prefer-native Use the native HLS downloader instead of
8b38f2ac
PH
219 ffmpeg
220 --hls-prefer-ffmpeg Use ffmpeg instead of the native HLS
221 downloader
a69bee47
PH
222 --hls-use-mpegts Use the mpegts container for HLS videos,
223 allowing to play the video while
224 downloading (some players may not be able
225 to play it)
c4af7684
PH
226 --external-downloader COMMAND Use the specified external downloader.
227 Currently supports
6bb26669 228 aria2c,avconv,axel,curl,ffmpeg,httpie,wget
c4af7684
PH
229 --external-downloader-args ARGS Give these arguments to the external
230 downloader
d5a62e4f 231
cfcec693 232## Filesystem Options:
c4af7684 233 -a, --batch-file FILE File containing URLs to download ('-' for
e8dfecb3
S
234 stdin), one URL per line. Lines starting
235 with '#', ';' or ']' are considered as
236 comments and ignored.
1dc2726f 237 --id Use only video ID in file name
bd1bcd3e
S
238 -o, --output TEMPLATE Output filename template, see the "OUTPUT
239 TEMPLATE" for all the info
4d2fdb07
S
240 --autonumber-start NUMBER Specify the start value for %(autonumber)s
241 (default is 1)
c4af7684
PH
242 --restrict-filenames Restrict filenames to only ASCII
243 characters, and avoid "&" and spaces in
244 filenames
1dc2726f 245 -w, --no-overwrites Do not overwrite files
c4af7684 246 -c, --continue Force resume of partially downloaded files.
cefecac1 247 By default, youtube-dlc will resume
c4af7684
PH
248 downloads if possible.
249 --no-continue Do not resume partially downloaded files
250 (restart from beginning)
251 --no-part Do not use .part files - write directly
252 into output file
253 --no-mtime Do not use the Last-modified header to set
254 the file modification time
255 --write-description Write video description to a .description
256 file
1dc2726f 257 --write-info-json Write video metadata to a .info.json file
c4af7684
PH
258 --write-annotations Write video annotations to a
259 .annotations.xml file
d845622b 260 --load-info-json FILE JSON file containing the video information
c4af7684
PH
261 (created with the "--write-info-json"
262 option)
263 --cookies FILE File to read cookies from and dump cookie
264 jar in
e3671279
U
265 --cache-dir DIR Location in the filesystem where youtube-
266 dlc can store some downloaded information
82674236 267 permanently. By default
cefecac1
U
268 $XDG_CACHE_HOME/youtube-dlc or
269 ~/.cache/youtube-dlc . At the moment, only
82674236
S
270 YouTube player files (for videos with
271 obfuscated signatures) are cached, but that
272 may change.
36f35428
PH
273 --no-cache-dir Disable filesystem caching
274 --rm-cache-dir Delete all filesystem cache files
6bcd846b 275
2b1bd292 276## Thumbnail images:
1dc2726f
PH
277 --write-thumbnail Write thumbnail image to disk
278 --write-all-thumbnails Write all thumbnail image formats to disk
c4af7684
PH
279 --list-thumbnails Simulate and list all available thumbnail
280 formats
2b1bd292 281
cfcec693 282## Verbosity / Simulation Options:
1dc2726f 283 -q, --quiet Activate quiet mode
6c072e7d 284 --no-warnings Ignore warnings
c4af7684
PH
285 -s, --simulate Do not download the video and do not write
286 anything to disk
1dc2726f
PH
287 --skip-download Do not download the video
288 -g, --get-url Simulate, quiet but print URL
289 -e, --get-title Simulate, quiet but print title
290 --get-id Simulate, quiet but print id
291 --get-thumbnail Simulate, quiet but print thumbnail URL
292 --get-description Simulate, quiet but print video description
293 --get-duration Simulate, quiet but print video length
294 --get-filename Simulate, quiet but print output filename
295 --get-format Simulate, quiet but print output format
c4af7684 296 -j, --dump-json Simulate, quiet but print JSON information.
cb1e6d89
S
297 See the "OUTPUT TEMPLATE" for a description
298 of available keys.
c4af7684
PH
299 -J, --dump-single-json Simulate, quiet but print JSON information
300 for each command-line argument. If the URL
301 refers to a playlist, dump the whole
302 playlist information in a single line.
303 --print-json Be quiet and print the video information as
304 JSON (video is still being downloaded).
1dc2726f
PH
305 --newline Output progress bar as new lines
306 --no-progress Do not print progress bar
307 --console-title Display progress in console titlebar
308 -v, --verbose Print various debugging information
c4af7684
PH
309 --dump-pages Print downloaded pages encoded using base64
310 to debug problems (very verbose)
311 --write-pages Write downloaded intermediary pages to
312 files in the current directory to debug
313 problems
780083db 314 --print-traffic Display sent and read HTTP traffic
e3671279
U
315 -C, --call-home Contact the youtube-dlc server for
316 debugging
cefecac1 317 --no-call-home Do NOT contact the youtube-dlc server for
c4af7684 318 debugging
6bcd846b 319
36f35428
PH
320## Workarounds:
321 --encoding ENCODING Force the specified encoding (experimental)
1dc2726f 322 --no-check-certificate Suppress HTTPS certificate validation
c4af7684 323 --prefer-insecure Use an unencrypted connection to retrieve
05a7ffb1
S
324 information about the video. (Currently
325 supported only for YouTube)
1dc2726f 326 --user-agent UA Specify a custom user agent
c4af7684
PH
327 --referer URL Specify a custom referer, use if the video
328 access is restricted to one domain
329 --add-header FIELD:VALUE Specify a custom HTTP header and its value,
330 separated by a colon ':'. You can use this
331 option multiple times
332 --bidi-workaround Work around terminals that lack
333 bidirectional text support. Requires bidiv
334 or fribidi executable in PATH
335 --sleep-interval SECONDS Number of seconds to sleep before each
b1ce2ba1
S
336 download when used alone or a lower bound
337 of a range for randomized sleep before each
338 download (minimum possible number of
339 seconds to sleep) when used along with
340 --max-sleep-interval.
341 --max-sleep-interval SECONDS Upper bound of a range for randomized sleep
342 before each download (maximum possible
343 number of seconds to sleep). Must only be
344 used along with --min-sleep-interval.
36f35428 345
cfcec693 346## Video Format Options:
c4af7684
PH
347 -f, --format FORMAT Video format code, see the "FORMAT
348 SELECTION" for all the info
1dc2726f 349 --all-formats Download all available video formats
c4af7684
PH
350 --prefer-free-formats Prefer free video formats unless a specific
351 one is requested
535d7b68 352 -F, --list-formats List all available formats of requested
bb6ac836 353 videos
c4af7684
PH
354 --youtube-skip-dash-manifest Do not download the DASH manifests and
355 related data on YouTube videos
356 --merge-output-format FORMAT If a merge is required (e.g.
357 bestvideo+bestaudio), output to given
358 container format. One of mkv, mp4, ogg,
359 webm, flv. Ignored if no merge is required
8ae7be3e
PH
360
361## Subtitle Options:
1dc2726f 362 --write-sub Write subtitle file
741dd8ea
RB
363 --write-auto-sub Write automatically generated subtitle file
364 (YouTube only)
c4af7684
PH
365 --all-subs Download all the available subtitles of the
366 video
1dc2726f 367 --list-subs List all available subtitles for the video
c4af7684
PH
368 --sub-format FORMAT Subtitle format, accepts formats
369 preference, for example: "srt" or
370 "ass/srt/best"
371 --sub-lang LANGS Languages of the subtitles to download
f733b053
PH
372 (optional) separated by commas, use --list-
373 subs for available language tags
6bcd846b 374
cfcec693 375## Authentication Options:
1dc2726f 376 -u, --username USERNAME Login with this account ID
c4af7684 377 -p, --password PASSWORD Account password. If this option is left
cefecac1 378 out, youtube-dlc will ask interactively.
dc48a354 379 -2, --twofactor TWOFACTOR Two-factor authentication code
1dc2726f 380 -n, --netrc Use .netrc authentication data
804c343a 381 --video-password PASSWORD Video password (vimeo, smotri, youku)
6bcd846b 382
f5e008d1
S
383## Adobe Pass Options:
384 --ap-mso MSO Adobe Pass multiple-system operator (TV
385 provider) identifier, use --ap-list-mso for
386 a list of available MSOs
387 --ap-username USERNAME Multiple-system operator account login
388 --ap-password PASSWORD Multiple-system operator account password.
e3671279
U
389 If this option is left out, youtube-dlc
390 will ask interactively.
f5e008d1
S
391 --ap-list-mso List all supported multiple-system
392 operators
393
cfcec693 394## Post-processing Options:
c4af7684
PH
395 -x, --extract-audio Convert video files to audio-only files
396 (requires ffmpeg or avconv and ffprobe or
397 avprobe)
398 --audio-format FORMAT Specify audio format: "best", "aac",
7d539ee1
S
399 "flac", "mp3", "m4a", "opus", "vorbis", or
400 "wav"; "best" by default; No effect without
401 -x
c4af7684
PH
402 --audio-quality QUALITY Specify ffmpeg/avconv audio quality, insert
403 a value between 0 (better) and 9 (worse)
404 for VBR or a specific bitrate like 128K
405 (default 5)
406 --recode-video FORMAT Encode the video to another format if
407 necessary (currently supported:
408 mp4|flv|ogg|webm|mkv|avi)
f72b0a60 409 --postprocessor-args ARGS Give these arguments to the postprocessor
c4af7684
PH
410 -k, --keep-video Keep the video file on disk after the post-
411 processing; the video is erased by default
412 --no-post-overwrites Do not overwrite post-processed files; the
413 post-processed files are overwritten by
414 default
0be8314d
PH
415 --embed-subs Embed subtitles in the video (only for mp4,
416 webm and mkv videos)
1dc2726f
PH
417 --embed-thumbnail Embed thumbnail in the audio as cover art
418 --add-metadata Write metadata to the video file
c4af7684
PH
419 --metadata-from-title FORMAT Parse additional metadata like song title /
420 artist from the video title. The format
6f3c632c
S
421 syntax is the same as --output. Regular
422 expression with named capture groups may
423 also be used. The parsed parameters replace
424 existing values. Example: --metadata-from-
425 title "%(artist)s - %(title)s" matches a
426 title like "Coldplay - Paradise". Example
427 (regex): --metadata-from-title
428 "(?P<artist>.+?) - (?P<title>.+)"
c4af7684
PH
429 --xattrs Write metadata to the video file's xattrs
430 (using dublin core and xdg standards)
431 --fixup POLICY Automatically correct known faults of the
432 file. One of never (do nothing), warn (only
433 emit a warning), detect_or_warn (the
434 default; fix file if we can, warn
435 otherwise)
436 --prefer-avconv Prefer avconv over ffmpeg for running the
c4af7684 437 postprocessors
689af496
S
438 --prefer-ffmpeg Prefer ffmpeg over avconv for running the
439 postprocessors (default)
c4af7684
PH
440 --ffmpeg-location PATH Location of the ffmpeg/avconv binary;
441 either the path to the binary or its
442 containing directory.
443 --exec CMD Execute a command on the file after
00a41ca4
S
444 downloading and post-processing, similar to
445 find's -exec syntax. Example: --exec 'adb
446 push {} /sdcard/Music/ && rm {}'
7de81fcc 447 --convert-subs FORMAT Convert the subtitles to other format
9fc41bcb 448 (currently supported: srt|ass|vtt|lrc)
6bcd846b 449