]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube-dl.1
9ab22b088eb9f20093113f24114b551de9843ebd
[youtubedl] / youtube-dl.1
1 .TH "YOUTUBE\-DL" "1" "" "" ""
2 .SH NAME
3 .PP
4 youtube\-dl \- download videos from youtube.com or other video platforms
5 .SH SYNOPSIS
6 .PP
7 \f[B]youtube\-dl\f[] [OPTIONS] URL [URL...]
8 .SH DESCRIPTION
9 .PP
10 \f[B]youtube\-dl\f[] is a command\-line program to download videos from
11 YouTube.com and a few more sites.
12 It requires the Python interpreter, version 2.6, 2.7, or 3.2+, and it is
13 not platform specific.
14 It should work on your Unix box, on Windows or on Mac OS X.
15 It is released to the public domain, which means you can modify it,
16 redistribute it or use it however you like.
17 .SH OPTIONS
18 .TP
19 .B \-h, \-\-help
20 Print this help text and exit
21 .RS
22 .RE
23 .TP
24 .B \-\-version
25 Print program version and exit
26 .RS
27 .RE
28 .TP
29 .B \-U, \-\-update
30 Update this program to latest version.
31 Make sure that you have sufficient permissions (run with sudo if needed)
32 .RS
33 .RE
34 .TP
35 .B \-i, \-\-ignore\-errors
36 Continue on download errors, for example to skip unavailable videos in a
37 playlist
38 .RS
39 .RE
40 .TP
41 .B \-\-abort\-on\-error
42 Abort downloading of further videos (in the playlist or the command
43 line) if an error occurs
44 .RS
45 .RE
46 .TP
47 .B \-\-dump\-user\-agent
48 Display the current browser identification
49 .RS
50 .RE
51 .TP
52 .B \-\-list\-extractors
53 List all supported extractors
54 .RS
55 .RE
56 .TP
57 .B \-\-extractor\-descriptions
58 Output descriptions of all supported extractors
59 .RS
60 .RE
61 .TP
62 .B \-\-force\-generic\-extractor
63 Force extraction to use the generic extractor
64 .RS
65 .RE
66 .TP
67 .B \-\-default\-search \f[I]PREFIX\f[]
68 Use this prefix for unqualified URLs.
69 For example "gvsearch2:" downloads two videos from google videos for
70 youtube\-dl "large apple".
71 Use the value "auto" to let youtube\-dl guess ("auto_warning" to emit a
72 warning when guessing).
73 "error" just throws an error.
74 The default value "fixup_error" repairs broken URLs, but emits an error
75 if this is not possible instead of searching.
76 .RS
77 .RE
78 .TP
79 .B \-\-ignore\-config
80 Do not read configuration files.
81 When given in the global configuration file /etc/youtube\-dl.conf: Do
82 not read the user configuration in ~/.config/youtube\- dl/config
83 (%APPDATA%/youtube\-dl/config.txt on Windows)
84 .RS
85 .RE
86 .TP
87 .B \-\-config\-location \f[I]PATH\f[]
88 Location of the configuration file; either the path to the config or its
89 containing directory.
90 .RS
91 .RE
92 .TP
93 .B \-\-flat\-playlist
94 Do not extract the videos of a playlist, only list them.
95 .RS
96 .RE
97 .TP
98 .B \-\-mark\-watched
99 Mark videos watched (YouTube only)
100 .RS
101 .RE
102 .TP
103 .B \-\-no\-mark\-watched
104 Do not mark videos watched (YouTube only)
105 .RS
106 .RE
107 .TP
108 .B \-\-no\-color
109 Do not emit color codes in output
110 .RS
111 .RE
112 .SS Network Options:
113 .TP
114 .B \-\-proxy \f[I]URL\f[]
115 Use the specified HTTP/HTTPS/SOCKS proxy.
116 To enable experimental SOCKS proxy, specify a proper scheme.
117 For example socks5://127.0.0.1:1080/.
118 Pass in an empty string (\-\-proxy "") for direct connection
119 .RS
120 .RE
121 .TP
122 .B \-\-socket\-timeout \f[I]SECONDS\f[]
123 Time to wait before giving up, in seconds
124 .RS
125 .RE
126 .TP
127 .B \-\-source\-address \f[I]IP\f[]
128 Client\-side IP address to bind to
129 .RS
130 .RE
131 .TP
132 .B \-4, \-\-force\-ipv4
133 Make all connections via IPv4
134 .RS
135 .RE
136 .TP
137 .B \-6, \-\-force\-ipv6
138 Make all connections via IPv6
139 .RS
140 .RE
141 .SS Geo Restriction:
142 .TP
143 .B \-\-geo\-verification\-proxy \f[I]URL\f[]
144 Use this proxy to verify the IP address for some geo\-restricted sites.
145 The default proxy specified by \-\-proxy (or none, if the options is not
146 present) is used for the actual downloading.
147 .RS
148 .RE
149 .TP
150 .B \-\-geo\-bypass
151 Bypass geographic restriction via faking X\-Forwarded\-For HTTP header
152 (experimental)
153 .RS
154 .RE
155 .TP
156 .B \-\-no\-geo\-bypass
157 Do not bypass geographic restriction via faking X\-Forwarded\-For HTTP
158 header (experimental)
159 .RS
160 .RE
161 .TP
162 .B \-\-geo\-bypass\-country \f[I]CODE\f[]
163 Force bypass geographic restriction with explicitly provided two\-letter
164 ISO 3166\-2 country code (experimental)
165 .RS
166 .RE
167 .SS Video Selection:
168 .TP
169 .B \-\-playlist\-start \f[I]NUMBER\f[]
170 Playlist video to start at (default is 1)
171 .RS
172 .RE
173 .TP
174 .B \-\-playlist\-end \f[I]NUMBER\f[]
175 Playlist video to end at (default is last)
176 .RS
177 .RE
178 .TP
179 .B \-\-playlist\-items \f[I]ITEM_SPEC\f[]
180 Playlist video items to download.
181 Specify indices of the videos in the playlist separated by commas like:
182 "\-\-playlist\-items 1,2,5,8" if you want to download videos indexed 1,
183 2, 5, 8 in the playlist.
184 You can specify range: "\-\-playlist\-items 1\-3,7,10\-13", it will
185 download the videos at index 1, 2, 3, 7, 10, 11, 12 and 13.
186 .RS
187 .RE
188 .TP
189 .B \-\-match\-title \f[I]REGEX\f[]
190 Download only matching titles (regex or caseless sub\-string)
191 .RS
192 .RE
193 .TP
194 .B \-\-reject\-title \f[I]REGEX\f[]
195 Skip download for matching titles (regex or caseless sub\-string)
196 .RS
197 .RE
198 .TP
199 .B \-\-max\-downloads \f[I]NUMBER\f[]
200 Abort after downloading NUMBER files
201 .RS
202 .RE
203 .TP
204 .B \-\-min\-filesize \f[I]SIZE\f[]
205 Do not download any videos smaller than SIZE (e.g.
206 50k or 44.6m)
207 .RS
208 .RE
209 .TP
210 .B \-\-max\-filesize \f[I]SIZE\f[]
211 Do not download any videos larger than SIZE (e.g.
212 50k or 44.6m)
213 .RS
214 .RE
215 .TP
216 .B \-\-date \f[I]DATE\f[]
217 Download only videos uploaded in this date
218 .RS
219 .RE
220 .TP
221 .B \-\-datebefore \f[I]DATE\f[]
222 Download only videos uploaded on or before this date (i.e.
223 inclusive)
224 .RS
225 .RE
226 .TP
227 .B \-\-dateafter \f[I]DATE\f[]
228 Download only videos uploaded on or after this date (i.e.
229 inclusive)
230 .RS
231 .RE
232 .TP
233 .B \-\-min\-views \f[I]COUNT\f[]
234 Do not download any videos with less than COUNT views
235 .RS
236 .RE
237 .TP
238 .B \-\-max\-views \f[I]COUNT\f[]
239 Do not download any videos with more than COUNT views
240 .RS
241 .RE
242 .TP
243 .B \-\-match\-filter \f[I]FILTER\f[]
244 Generic video filter.
245 Specify any key (see the "OUTPUT TEMPLATE" for a list of available keys)
246 to match if the key is present, !key to check if the key is not present,
247 key > NUMBER (like "comment_count > 12", also works with >=, <, <=, !=,
248 =) to compare against a number, key = \[aq]LITERAL\[aq] (like "uploader
249 = \[aq]Mike Smith\[aq]", also works with !=) to match against a string
250 literal and & to require multiple matches.
251 Values which are not known are excluded unless you put a question mark
252 (?) after the operator.
253 For example, to only match videos that have been liked more than 100
254 times and disliked less than 50 times (or the dislike functionality is
255 not available at the given service), but who also have a description,
256 use \-\-match\-filter "like_count > 100 & dislike_count <?
257 50 & description" .
258 .RS
259 .RE
260 .TP
261 .B \-\-no\-playlist
262 Download only the video, if the URL refers to a video and a playlist.
263 .RS
264 .RE
265 .TP
266 .B \-\-yes\-playlist
267 Download the playlist, if the URL refers to a video and a playlist.
268 .RS
269 .RE
270 .TP
271 .B \-\-age\-limit \f[I]YEARS\f[]
272 Download only videos suitable for the given age
273 .RS
274 .RE
275 .TP
276 .B \-\-download\-archive \f[I]FILE\f[]
277 Download only videos not listed in the archive file.
278 Record the IDs of all downloaded videos in it.
279 .RS
280 .RE
281 .TP
282 .B \-\-include\-ads
283 Download advertisements as well (experimental)
284 .RS
285 .RE
286 .SS Download Options:
287 .TP
288 .B \-r, \-\-limit\-rate \f[I]RATE\f[]
289 Maximum download rate in bytes per second (e.g.
290 50K or 4.2M)
291 .RS
292 .RE
293 .TP
294 .B \-R, \-\-retries \f[I]RETRIES\f[]
295 Number of retries (default is 10), or "infinite".
296 .RS
297 .RE
298 .TP
299 .B \-\-fragment\-retries \f[I]RETRIES\f[]
300 Number of retries for a fragment (default is 10), or "infinite" (DASH,
301 hlsnative and ISM)
302 .RS
303 .RE
304 .TP
305 .B \-\-skip\-unavailable\-fragments
306 Skip unavailable fragments (DASH, hlsnative and ISM)
307 .RS
308 .RE
309 .TP
310 .B \-\-abort\-on\-unavailable\-fragment
311 Abort downloading when some fragment is not available
312 .RS
313 .RE
314 .TP
315 .B \-\-keep\-fragments
316 Keep downloaded fragments on disk after downloading is finished;
317 fragments are erased by default
318 .RS
319 .RE
320 .TP
321 .B \-\-buffer\-size \f[I]SIZE\f[]
322 Size of download buffer (e.g.
323 1024 or 16K) (default is 1024)
324 .RS
325 .RE
326 .TP
327 .B \-\-no\-resize\-buffer
328 Do not automatically adjust the buffer size.
329 By default, the buffer size is automatically resized from an initial
330 value of SIZE.
331 .RS
332 .RE
333 .TP
334 .B \-\-playlist\-reverse
335 Download playlist videos in reverse order
336 .RS
337 .RE
338 .TP
339 .B \-\-playlist\-random
340 Download playlist videos in random order
341 .RS
342 .RE
343 .TP
344 .B \-\-xattr\-set\-filesize
345 Set file xattribute ytdl.filesize with expected file size (experimental)
346 .RS
347 .RE
348 .TP
349 .B \-\-hls\-prefer\-native
350 Use the native HLS downloader instead of ffmpeg
351 .RS
352 .RE
353 .TP
354 .B \-\-hls\-prefer\-ffmpeg
355 Use ffmpeg instead of the native HLS downloader
356 .RS
357 .RE
358 .TP
359 .B \-\-hls\-use\-mpegts
360 Use the mpegts container for HLS videos, allowing to play the video
361 while downloading (some players may not be able to play it)
362 .RS
363 .RE
364 .TP
365 .B \-\-external\-downloader \f[I]COMMAND\f[]
366 Use the specified external downloader.
367 Currently supports aria2c,avconv,axel,curl,ffmpeg,httpie,wget
368 .RS
369 .RE
370 .TP
371 .B \-\-external\-downloader\-args \f[I]ARGS\f[]
372 Give these arguments to the external downloader
373 .RS
374 .RE
375 .SS Filesystem Options:
376 .TP
377 .B \-a, \-\-batch\-file \f[I]FILE\f[]
378 File containing URLs to download (\[aq]\-\[aq] for stdin)
379 .RS
380 .RE
381 .TP
382 .B \-\-id
383 Use only video ID in file name
384 .RS
385 .RE
386 .TP
387 .B \-o, \-\-output \f[I]TEMPLATE\f[]
388 Output filename template, see the "OUTPUT TEMPLATE" for all the info
389 .RS
390 .RE
391 .TP
392 .B \-\-autonumber\-start \f[I]NUMBER\f[]
393 Specify the start value for %(autonumber)s (default is 1)
394 .RS
395 .RE
396 .TP
397 .B \-\-restrict\-filenames
398 Restrict filenames to only ASCII characters, and avoid "&" and spaces in
399 filenames
400 .RS
401 .RE
402 .TP
403 .B \-w, \-\-no\-overwrites
404 Do not overwrite files
405 .RS
406 .RE
407 .TP
408 .B \-c, \-\-continue
409 Force resume of partially downloaded files.
410 By default, youtube\-dl will resume downloads if possible.
411 .RS
412 .RE
413 .TP
414 .B \-\-no\-continue
415 Do not resume partially downloaded files (restart from beginning)
416 .RS
417 .RE
418 .TP
419 .B \-\-no\-part
420 Do not use .part files \- write directly into output file
421 .RS
422 .RE
423 .TP
424 .B \-\-no\-mtime
425 Do not use the Last\-modified header to set the file modification time
426 .RS
427 .RE
428 .TP
429 .B \-\-write\-description
430 Write video description to a .description file
431 .RS
432 .RE
433 .TP
434 .B \-\-write\-info\-json
435 Write video metadata to a .info.json file
436 .RS
437 .RE
438 .TP
439 .B \-\-write\-annotations
440 Write video annotations to a .annotations.xml file
441 .RS
442 .RE
443 .TP
444 .B \-\-load\-info\-json \f[I]FILE\f[]
445 JSON file containing the video information (created with the
446 "\-\-write\-info\-json" option)
447 .RS
448 .RE
449 .TP
450 .B \-\-cookies \f[I]FILE\f[]
451 File to read cookies from and dump cookie jar in
452 .RS
453 .RE
454 .TP
455 .B \-\-cache\-dir \f[I]DIR\f[]
456 Location in the filesystem where youtube\-dl can store some downloaded
457 information permanently.
458 By default $XDG_CACHE_HOME/youtube\-dl or ~/.cache/youtube\-dl .
459 At the moment, only YouTube player files (for videos with obfuscated
460 signatures) are cached, but that may change.
461 .RS
462 .RE
463 .TP
464 .B \-\-no\-cache\-dir
465 Disable filesystem caching
466 .RS
467 .RE
468 .TP
469 .B \-\-rm\-cache\-dir
470 Delete all filesystem cache files
471 .RS
472 .RE
473 .SS Thumbnail images:
474 .TP
475 .B \-\-write\-thumbnail
476 Write thumbnail image to disk
477 .RS
478 .RE
479 .TP
480 .B \-\-write\-all\-thumbnails
481 Write all thumbnail image formats to disk
482 .RS
483 .RE
484 .TP
485 .B \-\-list\-thumbnails
486 Simulate and list all available thumbnail formats
487 .RS
488 .RE
489 .SS Verbosity / Simulation Options:
490 .TP
491 .B \-q, \-\-quiet
492 Activate quiet mode
493 .RS
494 .RE
495 .TP
496 .B \-\-no\-warnings
497 Ignore warnings
498 .RS
499 .RE
500 .TP
501 .B \-s, \-\-simulate
502 Do not download the video and do not write anything to disk
503 .RS
504 .RE
505 .TP
506 .B \-\-skip\-download
507 Do not download the video
508 .RS
509 .RE
510 .TP
511 .B \-g, \-\-get\-url
512 Simulate, quiet but print URL
513 .RS
514 .RE
515 .TP
516 .B \-e, \-\-get\-title
517 Simulate, quiet but print title
518 .RS
519 .RE
520 .TP
521 .B \-\-get\-id
522 Simulate, quiet but print id
523 .RS
524 .RE
525 .TP
526 .B \-\-get\-thumbnail
527 Simulate, quiet but print thumbnail URL
528 .RS
529 .RE
530 .TP
531 .B \-\-get\-description
532 Simulate, quiet but print video description
533 .RS
534 .RE
535 .TP
536 .B \-\-get\-duration
537 Simulate, quiet but print video length
538 .RS
539 .RE
540 .TP
541 .B \-\-get\-filename
542 Simulate, quiet but print output filename
543 .RS
544 .RE
545 .TP
546 .B \-\-get\-format
547 Simulate, quiet but print output format
548 .RS
549 .RE
550 .TP
551 .B \-j, \-\-dump\-json
552 Simulate, quiet but print JSON information.
553 See the "OUTPUT TEMPLATE" for a description of available keys.
554 .RS
555 .RE
556 .TP
557 .B \-J, \-\-dump\-single\-json
558 Simulate, quiet but print JSON information for each command\-line
559 argument.
560 If the URL refers to a playlist, dump the whole playlist information in
561 a single line.
562 .RS
563 .RE
564 .TP
565 .B \-\-print\-json
566 Be quiet and print the video information as JSON (video is still being
567 downloaded).
568 .RS
569 .RE
570 .TP
571 .B \-\-newline
572 Output progress bar as new lines
573 .RS
574 .RE
575 .TP
576 .B \-\-no\-progress
577 Do not print progress bar
578 .RS
579 .RE
580 .TP
581 .B \-\-console\-title
582 Display progress in console titlebar
583 .RS
584 .RE
585 .TP
586 .B \-v, \-\-verbose
587 Print various debugging information
588 .RS
589 .RE
590 .TP
591 .B \-\-dump\-pages
592 Print downloaded pages encoded using base64 to debug problems (very
593 verbose)
594 .RS
595 .RE
596 .TP
597 .B \-\-write\-pages
598 Write downloaded intermediary pages to files in the current directory to
599 debug problems
600 .RS
601 .RE
602 .TP
603 .B \-\-print\-traffic
604 Display sent and read HTTP traffic
605 .RS
606 .RE
607 .TP
608 .B \-C, \-\-call\-home
609 Contact the youtube\-dl server for debugging
610 .RS
611 .RE
612 .TP
613 .B \-\-no\-call\-home
614 Do NOT contact the youtube\-dl server for debugging
615 .RS
616 .RE
617 .SS Workarounds:
618 .TP
619 .B \-\-encoding \f[I]ENCODING\f[]
620 Force the specified encoding (experimental)
621 .RS
622 .RE
623 .TP
624 .B \-\-no\-check\-certificate
625 Suppress HTTPS certificate validation
626 .RS
627 .RE
628 .TP
629 .B \-\-prefer\-insecure
630 Use an unencrypted connection to retrieve information about the video.
631 (Currently supported only for YouTube)
632 .RS
633 .RE
634 .TP
635 .B \-\-user\-agent \f[I]UA\f[]
636 Specify a custom user agent
637 .RS
638 .RE
639 .TP
640 .B \-\-referer \f[I]URL\f[]
641 Specify a custom referer, use if the video access is restricted to one
642 domain
643 .RS
644 .RE
645 .TP
646 .B \-\-add\-header \f[I]FIELD:VALUE\f[]
647 Specify a custom HTTP header and its value, separated by a colon
648 \[aq]:\[aq].
649 You can use this option multiple times
650 .RS
651 .RE
652 .TP
653 .B \-\-bidi\-workaround
654 Work around terminals that lack bidirectional text support.
655 Requires bidiv or fribidi executable in PATH
656 .RS
657 .RE
658 .TP
659 .B \-\-sleep\-interval \f[I]SECONDS\f[]
660 Number of seconds to sleep before each download when used alone or a
661 lower bound of a range for randomized sleep before each download
662 (minimum possible number of seconds to sleep) when used along with
663 \-\-max\-sleep\-interval.
664 .RS
665 .RE
666 .TP
667 .B \-\-max\-sleep\-interval \f[I]SECONDS\f[]
668 Upper bound of a range for randomized sleep before each download
669 (maximum possible number of seconds to sleep).
670 Must only be used along with \-\-min\-sleep\-interval.
671 .RS
672 .RE
673 .SS Video Format Options:
674 .TP
675 .B \-f, \-\-format \f[I]FORMAT\f[]
676 Video format code, see the "FORMAT SELECTION" for all the info
677 .RS
678 .RE
679 .TP
680 .B \-\-all\-formats
681 Download all available video formats
682 .RS
683 .RE
684 .TP
685 .B \-\-prefer\-free\-formats
686 Prefer free video formats unless a specific one is requested
687 .RS
688 .RE
689 .TP
690 .B \-F, \-\-list\-formats
691 List all available formats of requested videos
692 .RS
693 .RE
694 .TP
695 .B \-\-youtube\-skip\-dash\-manifest
696 Do not download the DASH manifests and related data on YouTube videos
697 .RS
698 .RE
699 .TP
700 .B \-\-merge\-output\-format \f[I]FORMAT\f[]
701 If a merge is required (e.g.
702 bestvideo+bestaudio), output to given container format.
703 One of mkv, mp4, ogg, webm, flv.
704 Ignored if no merge is required
705 .RS
706 .RE
707 .SS Subtitle Options:
708 .TP
709 .B \-\-write\-sub
710 Write subtitle file
711 .RS
712 .RE
713 .TP
714 .B \-\-write\-auto\-sub
715 Write automatically generated subtitle file (YouTube only)
716 .RS
717 .RE
718 .TP
719 .B \-\-all\-subs
720 Download all the available subtitles of the video
721 .RS
722 .RE
723 .TP
724 .B \-\-list\-subs
725 List all available subtitles for the video
726 .RS
727 .RE
728 .TP
729 .B \-\-sub\-format \f[I]FORMAT\f[]
730 Subtitle format, accepts formats preference, for example: "srt" or
731 "ass/srt/best"
732 .RS
733 .RE
734 .TP
735 .B \-\-sub\-lang \f[I]LANGS\f[]
736 Languages of the subtitles to download (optional) separated by commas,
737 use \-\-list\- subs for available language tags
738 .RS
739 .RE
740 .SS Authentication Options:
741 .TP
742 .B \-u, \-\-username \f[I]USERNAME\f[]
743 Login with this account ID
744 .RS
745 .RE
746 .TP
747 .B \-p, \-\-password \f[I]PASSWORD\f[]
748 Account password.
749 If this option is left out, youtube\-dl will ask interactively.
750 .RS
751 .RE
752 .TP
753 .B \-2, \-\-twofactor \f[I]TWOFACTOR\f[]
754 Two\-factor authentication code
755 .RS
756 .RE
757 .TP
758 .B \-n, \-\-netrc
759 Use .netrc authentication data
760 .RS
761 .RE
762 .TP
763 .B \-\-video\-password \f[I]PASSWORD\f[]
764 Video password (vimeo, smotri, youku)
765 .RS
766 .RE
767 .SS Adobe Pass Options:
768 .TP
769 .B \-\-ap\-mso \f[I]MSO\f[]
770 Adobe Pass multiple\-system operator (TV provider) identifier, use
771 \-\-ap\-list\-mso for a list of available MSOs
772 .RS
773 .RE
774 .TP
775 .B \-\-ap\-username \f[I]USERNAME\f[]
776 Multiple\-system operator account login
777 .RS
778 .RE
779 .TP
780 .B \-\-ap\-password \f[I]PASSWORD\f[]
781 Multiple\-system operator account password.
782 If this option is left out, youtube\-dl will ask interactively.
783 .RS
784 .RE
785 .TP
786 .B \-\-ap\-list\-mso
787 List all supported multiple\-system operators
788 .RS
789 .RE
790 .SS Post\-processing Options:
791 .TP
792 .B \-x, \-\-extract\-audio
793 Convert video files to audio\-only files (requires ffmpeg or avconv and
794 ffprobe or avprobe)
795 .RS
796 .RE
797 .TP
798 .B \-\-audio\-format \f[I]FORMAT\f[]
799 Specify audio format: "best", "aac", "flac", "mp3", "m4a", "opus",
800 "vorbis", or "wav"; "best" by default; No effect without \-x
801 .RS
802 .RE
803 .TP
804 .B \-\-audio\-quality \f[I]QUALITY\f[]
805 Specify ffmpeg/avconv audio quality, insert a value between 0 (better)
806 and 9 (worse) for VBR or a specific bitrate like 128K (default 5)
807 .RS
808 .RE
809 .TP
810 .B \-\-recode\-video \f[I]FORMAT\f[]
811 Encode the video to another format if necessary (currently supported:
812 mp4|flv|ogg|webm|mkv|avi)
813 .RS
814 .RE
815 .TP
816 .B \-\-postprocessor\-args \f[I]ARGS\f[]
817 Give these arguments to the postprocessor
818 .RS
819 .RE
820 .TP
821 .B \-k, \-\-keep\-video
822 Keep the video file on disk after the post\- processing; the video is
823 erased by default
824 .RS
825 .RE
826 .TP
827 .B \-\-no\-post\-overwrites
828 Do not overwrite post\-processed files; the post\-processed files are
829 overwritten by default
830 .RS
831 .RE
832 .TP
833 .B \-\-embed\-subs
834 Embed subtitles in the video (only for mp4, webm and mkv videos)
835 .RS
836 .RE
837 .TP
838 .B \-\-embed\-thumbnail
839 Embed thumbnail in the audio as cover art
840 .RS
841 .RE
842 .TP
843 .B \-\-add\-metadata
844 Write metadata to the video file
845 .RS
846 .RE
847 .TP
848 .B \-\-metadata\-from\-title \f[I]FORMAT\f[]
849 Parse additional metadata like song title / artist from the video title.
850 The format syntax is the same as \-\-output.
851 Regular expression with named capture groups may also be used.
852 The parsed parameters replace existing values.
853 Example: \-\-metadata\-from\- title "%(artist)s \- %(title)s" matches a
854 title like "Coldplay \- Paradise".
855 Example (regex): \-\-metadata\-from\-title "(?P.+?) \- (?P
856 .RS
857 \&.+)"
858 .RE
859 .TP
860 .B \-\-xattrs
861 Write metadata to the video file\[aq]s xattrs (using dublin core and xdg
862 standards)
863 .RS
864 .RE
865 .TP
866 .B \-\-fixup \f[I]POLICY\f[]
867 Automatically correct known faults of the file.
868 One of never (do nothing), warn (only emit a warning), detect_or_warn
869 (the default; fix file if we can, warn otherwise)
870 .RS
871 .RE
872 .TP
873 .B \-\-prefer\-avconv
874 Prefer avconv over ffmpeg for running the postprocessors (default)
875 .RS
876 .RE
877 .TP
878 .B \-\-prefer\-ffmpeg
879 Prefer ffmpeg over avconv for running the postprocessors
880 .RS
881 .RE
882 .TP
883 .B \-\-ffmpeg\-location \f[I]PATH\f[]
884 Location of the ffmpeg/avconv binary; either the path to the binary or
885 its containing directory.
886 .RS
887 .RE
888 .TP
889 .B \-\-exec \f[I]CMD\f[]
890 Execute a command on the file after downloading, similar to find\[aq]s
891 \-exec syntax.
892 Example: \-\-exec \[aq]adb push {} /sdcard/Music/ && rm {}\[aq]
893 .RS
894 .RE
895 .TP
896 .B \-\-convert\-subs \f[I]FORMAT\f[]
897 Convert the subtitles to other format (currently supported:
898 srt|ass|vtt|lrc)
899 .RS
900 .RE
901 .SH CONFIGURATION
902 .PP
903 You can configure youtube\-dl by placing any supported command line
904 option to a configuration file.
905 On Linux and OS X, the system wide configuration file is located at
906 \f[C]/etc/youtube\-dl.conf\f[] and the user wide configuration file at
907 \f[C]~/.config/youtube\-dl/config\f[].
908 On Windows, the user wide configuration file locations are
909 \f[C]%APPDATA%\\youtube\-dl\\config.txt\f[] or
910 \f[C]C:\\Users\\<user\ name>\\youtube\-dl.conf\f[].
911 Note that by default configuration file may not exist so you may need to
912 create it yourself.
913 .PP
914 For example, with the following configuration file youtube\-dl will
915 always extract the audio, not copy the mtime, use a proxy and save all
916 videos under \f[C]Movies\f[] directory in your home directory:
917 .IP
918 .nf
919 \f[C]
920 #\ Lines\ starting\ with\ #\ are\ comments
921
922 #\ Always\ extract\ audio
923 \-x
924
925 #\ Do\ not\ copy\ the\ mtime
926 \-\-no\-mtime
927
928 #\ Use\ this\ proxy
929 \-\-proxy\ 127.0.0.1:3128
930
931 #\ Save\ all\ videos\ under\ Movies\ directory\ in\ your\ home\ directory
932 \-o\ ~/Movies/%(title)s.%(ext)s
933 \f[]
934 .fi
935 .PP
936 Note that options in configuration file are just the same options aka
937 switches used in regular command line calls thus there \f[B]must be no
938 whitespace\f[] after \f[C]\-\f[] or \f[C]\-\-\f[], e.g.
939 \f[C]\-o\f[] or \f[C]\-\-proxy\f[] but not \f[C]\-\ o\f[] or
940 \f[C]\-\-\ proxy\f[].
941 .PP
942 You can use \f[C]\-\-ignore\-config\f[] if you want to disable the
943 configuration file for a particular youtube\-dl run.
944 .PP
945 You can also use \f[C]\-\-config\-location\f[] if you want to use custom
946 configuration file for a particular youtube\-dl run.
947 .SS Authentication with \f[C]\&.netrc\f[] file
948 .PP
949 You may also want to configure automatic credentials storage for
950 extractors that support authentication (by providing login and password
951 with \f[C]\-\-username\f[] and \f[C]\-\-password\f[]) in order not to
952 pass credentials as command line arguments on every youtube\-dl
953 execution and prevent tracking plain text passwords in the shell command
954 history.
955 You can achieve this using a \f[C]\&.netrc\f[]
956 file (https://stackoverflow.com/tags/.netrc/info) on a per extractor
957 basis.
958 For that you will need to create a \f[C]\&.netrc\f[] file in your
959 \f[C]$HOME\f[] and restrict permissions to read/write by only you:
960 .IP
961 .nf
962 \f[C]
963 touch\ $HOME/.netrc
964 chmod\ a\-rwx,u+rw\ $HOME/.netrc
965 \f[]
966 .fi
967 .PP
968 After that you can add credentials for an extractor in the following
969 format, where \f[I]extractor\f[] is the name of the extractor in
970 lowercase:
971 .IP
972 .nf
973 \f[C]
974 machine\ <extractor>\ login\ <login>\ password\ <password>
975 \f[]
976 .fi
977 .PP
978 For example:
979 .IP
980 .nf
981 \f[C]
982 machine\ youtube\ login\ myaccount\@gmail.com\ password\ my_youtube_password
983 machine\ twitch\ login\ my_twitch_account_name\ password\ my_twitch_password
984 \f[]
985 .fi
986 .PP
987 To activate authentication with the \f[C]\&.netrc\f[] file you should
988 pass \f[C]\-\-netrc\f[] to youtube\-dl or place it in the configuration
989 file (#configuration).
990 .PP
991 On Windows you may also need to setup the \f[C]%HOME%\f[] environment
992 variable manually.
993 For example:
994 .IP
995 .nf
996 \f[C]
997 set\ HOME=%USERPROFILE%
998 \f[]
999 .fi
1000 .SH OUTPUT TEMPLATE
1001 .PP
1002 The \f[C]\-o\f[] option allows users to indicate a template for the
1003 output file names.
1004 .PP
1005 \f[B]tl;dr:\f[] navigate me to examples (#output-template-examples).
1006 .PP
1007 The basic usage is not to set any template arguments when downloading a
1008 single file, like in
1009 \f[C]youtube\-dl\ \-o\ funny_video.flv\ "https://some/video"\f[].
1010 However, it may contain special sequences that will be replaced when
1011 downloading each video.
1012 The special sequences may be formatted according to python string
1013 formatting
1014 operations (https://docs.python.org/2/library/stdtypes.html#string-formatting).
1015 For example, \f[C]%(NAME)s\f[] or \f[C]%(NAME)05d\f[].
1016 To clarify, that is a percent symbol followed by a name in parentheses,
1017 followed by a formatting operations.
1018 Allowed names along with sequence type are:
1019 .IP \[bu] 2
1020 \f[C]id\f[] (string): Video identifier
1021 .IP \[bu] 2
1022 \f[C]title\f[] (string): Video title
1023 .IP \[bu] 2
1024 \f[C]url\f[] (string): Video URL
1025 .IP \[bu] 2
1026 \f[C]ext\f[] (string): Video filename extension
1027 .IP \[bu] 2
1028 \f[C]alt_title\f[] (string): A secondary title of the video
1029 .IP \[bu] 2
1030 \f[C]display_id\f[] (string): An alternative identifier for the video
1031 .IP \[bu] 2
1032 \f[C]uploader\f[] (string): Full name of the video uploader
1033 .IP \[bu] 2
1034 \f[C]license\f[] (string): License name the video is licensed under
1035 .IP \[bu] 2
1036 \f[C]creator\f[] (string): The creator of the video
1037 .IP \[bu] 2
1038 \f[C]release_date\f[] (string): The date (YYYYMMDD) when the video was
1039 released
1040 .IP \[bu] 2
1041 \f[C]timestamp\f[] (numeric): UNIX timestamp of the moment the video
1042 became available
1043 .IP \[bu] 2
1044 \f[C]upload_date\f[] (string): Video upload date (YYYYMMDD)
1045 .IP \[bu] 2
1046 \f[C]uploader_id\f[] (string): Nickname or id of the video uploader
1047 .IP \[bu] 2
1048 \f[C]location\f[] (string): Physical location where the video was filmed
1049 .IP \[bu] 2
1050 \f[C]duration\f[] (numeric): Length of the video in seconds
1051 .IP \[bu] 2
1052 \f[C]view_count\f[] (numeric): How many users have watched the video on
1053 the platform
1054 .IP \[bu] 2
1055 \f[C]like_count\f[] (numeric): Number of positive ratings of the video
1056 .IP \[bu] 2
1057 \f[C]dislike_count\f[] (numeric): Number of negative ratings of the
1058 video
1059 .IP \[bu] 2
1060 \f[C]repost_count\f[] (numeric): Number of reposts of the video
1061 .IP \[bu] 2
1062 \f[C]average_rating\f[] (numeric): Average rating give by users, the
1063 scale used depends on the webpage
1064 .IP \[bu] 2
1065 \f[C]comment_count\f[] (numeric): Number of comments on the video
1066 .IP \[bu] 2
1067 \f[C]age_limit\f[] (numeric): Age restriction for the video (years)
1068 .IP \[bu] 2
1069 \f[C]format\f[] (string): A human\-readable description of the format
1070 .IP \[bu] 2
1071 \f[C]format_id\f[] (string): Format code specified by
1072 \f[C]\-\-format\f[]
1073 .IP \[bu] 2
1074 \f[C]format_note\f[] (string): Additional info about the format
1075 .IP \[bu] 2
1076 \f[C]width\f[] (numeric): Width of the video
1077 .IP \[bu] 2
1078 \f[C]height\f[] (numeric): Height of the video
1079 .IP \[bu] 2
1080 \f[C]resolution\f[] (string): Textual description of width and height
1081 .IP \[bu] 2
1082 \f[C]tbr\f[] (numeric): Average bitrate of audio and video in KBit/s
1083 .IP \[bu] 2
1084 \f[C]abr\f[] (numeric): Average audio bitrate in KBit/s
1085 .IP \[bu] 2
1086 \f[C]acodec\f[] (string): Name of the audio codec in use
1087 .IP \[bu] 2
1088 \f[C]asr\f[] (numeric): Audio sampling rate in Hertz
1089 .IP \[bu] 2
1090 \f[C]vbr\f[] (numeric): Average video bitrate in KBit/s
1091 .IP \[bu] 2
1092 \f[C]fps\f[] (numeric): Frame rate
1093 .IP \[bu] 2
1094 \f[C]vcodec\f[] (string): Name of the video codec in use
1095 .IP \[bu] 2
1096 \f[C]container\f[] (string): Name of the container format
1097 .IP \[bu] 2
1098 \f[C]filesize\f[] (numeric): The number of bytes, if known in advance
1099 .IP \[bu] 2
1100 \f[C]filesize_approx\f[] (numeric): An estimate for the number of bytes
1101 .IP \[bu] 2
1102 \f[C]protocol\f[] (string): The protocol that will be used for the
1103 actual download
1104 .IP \[bu] 2
1105 \f[C]extractor\f[] (string): Name of the extractor
1106 .IP \[bu] 2
1107 \f[C]extractor_key\f[] (string): Key name of the extractor
1108 .IP \[bu] 2
1109 \f[C]epoch\f[] (numeric): Unix epoch when creating the file
1110 .IP \[bu] 2
1111 \f[C]autonumber\f[] (numeric): Five\-digit number that will be increased
1112 with each download, starting at zero
1113 .IP \[bu] 2
1114 \f[C]playlist\f[] (string): Name or id of the playlist that contains the
1115 video
1116 .IP \[bu] 2
1117 \f[C]playlist_index\f[] (numeric): Index of the video in the playlist
1118 padded with leading zeros according to the total length of the playlist
1119 .IP \[bu] 2
1120 \f[C]playlist_id\f[] (string): Playlist identifier
1121 .IP \[bu] 2
1122 \f[C]playlist_title\f[] (string): Playlist title
1123 .PP
1124 Available for the video that belongs to some logical chapter or section:
1125 .IP \[bu] 2
1126 \f[C]chapter\f[] (string): Name or title of the chapter the video
1127 belongs to
1128 .IP \[bu] 2
1129 \f[C]chapter_number\f[] (numeric): Number of the chapter the video
1130 belongs to
1131 .IP \[bu] 2
1132 \f[C]chapter_id\f[] (string): Id of the chapter the video belongs to
1133 .PP
1134 Available for the video that is an episode of some series or programme:
1135 .IP \[bu] 2
1136 \f[C]series\f[] (string): Title of the series or programme the video
1137 episode belongs to
1138 .IP \[bu] 2
1139 \f[C]season\f[] (string): Title of the season the video episode belongs
1140 to
1141 .IP \[bu] 2
1142 \f[C]season_number\f[] (numeric): Number of the season the video episode
1143 belongs to
1144 .IP \[bu] 2
1145 \f[C]season_id\f[] (string): Id of the season the video episode belongs
1146 to
1147 .IP \[bu] 2
1148 \f[C]episode\f[] (string): Title of the video episode
1149 .IP \[bu] 2
1150 \f[C]episode_number\f[] (numeric): Number of the video episode within a
1151 season
1152 .IP \[bu] 2
1153 \f[C]episode_id\f[] (string): Id of the video episode
1154 .PP
1155 Available for the media that is a track or a part of a music album:
1156 .IP \[bu] 2
1157 \f[C]track\f[] (string): Title of the track
1158 .IP \[bu] 2
1159 \f[C]track_number\f[] (numeric): Number of the track within an album or
1160 a disc
1161 .IP \[bu] 2
1162 \f[C]track_id\f[] (string): Id of the track
1163 .IP \[bu] 2
1164 \f[C]artist\f[] (string): Artist(s) of the track
1165 .IP \[bu] 2
1166 \f[C]genre\f[] (string): Genre(s) of the track
1167 .IP \[bu] 2
1168 \f[C]album\f[] (string): Title of the album the track belongs to
1169 .IP \[bu] 2
1170 \f[C]album_type\f[] (string): Type of the album
1171 .IP \[bu] 2
1172 \f[C]album_artist\f[] (string): List of all artists appeared on the
1173 album
1174 .IP \[bu] 2
1175 \f[C]disc_number\f[] (numeric): Number of the disc or other physical
1176 medium the track belongs to
1177 .IP \[bu] 2
1178 \f[C]release_year\f[] (numeric): Year (YYYY) when the album was released
1179 .PP
1180 Each aforementioned sequence when referenced in an output template will
1181 be replaced by the actual value corresponding to the sequence name.
1182 Note that some of the sequences are not guaranteed to be present since
1183 they depend on the metadata obtained by a particular extractor.
1184 Such sequences will be replaced with \f[C]NA\f[].
1185 .PP
1186 For example for \f[C]\-o\ %(title)s\-%(id)s.%(ext)s\f[] and an mp4 video
1187 with title \f[C]youtube\-dl\ test\ video\f[] and id
1188 \f[C]BaW_jenozKcj\f[], this will result in a
1189 \f[C]youtube\-dl\ test\ video\-BaW_jenozKcj.mp4\f[] file created in the
1190 current directory.
1191 .PP
1192 For numeric sequences you can use numeric related formatting, for
1193 example, \f[C]%(view_count)05d\f[] will result in a string with view
1194 count padded with zeros up to 5 characters, like in \f[C]00042\f[].
1195 .PP
1196 Output templates can also contain arbitrary hierarchical path, e.g.
1197 \f[C]\-o\ \[aq]%(playlist)s/%(playlist_index)s\ \-\ %(title)s.%(ext)s\[aq]\f[]
1198 which will result in downloading each video in a directory corresponding
1199 to this path template.
1200 Any missing directory will be automatically created for you.
1201 .PP
1202 To use percent literals in an output template use \f[C]%%\f[].
1203 To output to stdout use \f[C]\-o\ \-\f[].
1204 .PP
1205 The current default template is \f[C]%(title)s\-%(id)s.%(ext)s\f[].
1206 .PP
1207 In some cases, you don\[aq]t want special characters such as äø­, spaces,
1208 or &, such as when transferring the downloaded filename to a Windows
1209 system or the filename through an 8bit\-unsafe channel.
1210 In these cases, add the \f[C]\-\-restrict\-filenames\f[] flag to get a
1211 shorter title:
1212 .SS Output template and Windows batch files
1213 .PP
1214 If you are using an output template inside a Windows batch file then you
1215 must escape plain percent characters (\f[C]%\f[]) by doubling, so that
1216 \f[C]\-o\ "%(title)s\-%(id)s.%(ext)s"\f[] should become
1217 \f[C]\-o\ "%%(title)s\-%%(id)s.%%(ext)s"\f[].
1218 However you should not touch \f[C]%\f[]\[aq]s that are not plain
1219 characters, e.g.
1220 environment variables for expansion should stay intact:
1221 \f[C]\-o\ "C:\\%HOMEPATH%\\Desktop\\%%(title)s.%%(ext)s"\f[].
1222 .SS Output template examples
1223 .PP
1224 Note that on Windows you may need to use double quotes instead of
1225 single.
1226 .IP
1227 .nf
1228 \f[C]
1229 $\ youtube\-dl\ \-\-get\-filename\ \-o\ \[aq]%(title)s.%(ext)s\[aq]\ BaW_jenozKc
1230 youtube\-dl\ test\ video\ \[aq]\[aq]_Ƥā†­š•.mp4\ \ \ \ #\ All\ kinds\ of\ weird\ characters
1231
1232 $\ youtube\-dl\ \-\-get\-filename\ \-o\ \[aq]%(title)s.%(ext)s\[aq]\ BaW_jenozKc\ \-\-restrict\-filenames
1233 youtube\-dl_test_video_.mp4\ \ \ \ \ \ \ \ \ \ #\ A\ simple\ file\ name
1234
1235 #\ Download\ YouTube\ playlist\ videos\ in\ separate\ directory\ indexed\ by\ video\ order\ in\ a\ playlist
1236 $\ youtube\-dl\ \-o\ \[aq]%(playlist)s/%(playlist_index)s\ \-\ %(title)s.%(ext)s\[aq]\ https://www.youtube.com/playlist?list=PLwiyx1dc3P2JR9N8gQaQN_BCvlSlap7re
1237
1238 #\ Download\ all\ playlists\ of\ YouTube\ channel/user\ keeping\ each\ playlist\ in\ separate\ directory:
1239 $\ youtube\-dl\ \-o\ \[aq]%(uploader)s/%(playlist)s/%(playlist_index)s\ \-\ %(title)s.%(ext)s\[aq]\ https://www.youtube.com/user/TheLinuxFoundation/playlists
1240
1241 #\ Download\ Udemy\ course\ keeping\ each\ chapter\ in\ separate\ directory\ under\ MyVideos\ directory\ in\ your\ home
1242 $\ youtube\-dl\ \-u\ user\ \-p\ password\ \-o\ \[aq]~/MyVideos/%(playlist)s/%(chapter_number)s\ \-\ %(chapter)s/%(title)s.%(ext)s\[aq]\ https://www.udemy.com/java\-tutorial/
1243
1244 #\ Download\ entire\ series\ season\ keeping\ each\ series\ and\ each\ season\ in\ separate\ directory\ under\ C:/MyVideos
1245 $\ youtube\-dl\ \-o\ "C:/MyVideos/%(series)s/%(season_number)s\ \-\ %(season)s/%(episode_number)s\ \-\ %(episode)s.%(ext)s"\ https://videomore.ru/kino_v_detalayah/5_sezon/367617
1246
1247 #\ Stream\ the\ video\ being\ downloaded\ to\ stdout
1248 $\ youtube\-dl\ \-o\ \-\ BaW_jenozKc
1249 \f[]
1250 .fi
1251 .SH FORMAT SELECTION
1252 .PP
1253 By default youtube\-dl tries to download the best available quality,
1254 i.e.
1255 if you want the best quality you \f[B]don\[aq]t need\f[] to pass any
1256 special options, youtube\-dl will guess it for you by \f[B]default\f[].
1257 .PP
1258 But sometimes you may want to download in a different format, for
1259 example when you are on a slow or intermittent connection.
1260 The key mechanism for achieving this is so\-called \f[I]format
1261 selection\f[] based on which you can explicitly specify desired format,
1262 select formats based on some criterion or criteria, setup precedence and
1263 much more.
1264 .PP
1265 The general syntax for format selection is \f[C]\-\-format\ FORMAT\f[]
1266 or shorter \f[C]\-f\ FORMAT\f[] where \f[C]FORMAT\f[] is a \f[I]selector
1267 expression\f[], i.e.
1268 an expression that describes format or formats you would like to
1269 download.
1270 .PP
1271 \f[B]tl;dr:\f[] navigate me to examples (#format-selection-examples).
1272 .PP
1273 The simplest case is requesting a specific format, for example with
1274 \f[C]\-f\ 22\f[] you can download the format with format code equal to
1275 22.
1276 You can get the list of available format codes for particular video
1277 using \f[C]\-\-list\-formats\f[] or \f[C]\-F\f[].
1278 Note that these format codes are extractor specific.
1279 .PP
1280 You can also use a file extension (currently \f[C]3gp\f[], \f[C]aac\f[],
1281 \f[C]flv\f[], \f[C]m4a\f[], \f[C]mp3\f[], \f[C]mp4\f[], \f[C]ogg\f[],
1282 \f[C]wav\f[], \f[C]webm\f[] are supported) to download the best quality
1283 format of a particular file extension served as a single file, e.g.
1284 \f[C]\-f\ webm\f[] will download the best quality format with the
1285 \f[C]webm\f[] extension served as a single file.
1286 .PP
1287 You can also use special names to select particular edge case formats:
1288 \- \f[C]best\f[]: Select the best quality format represented by a single
1289 file with video and audio.
1290 \- \f[C]worst\f[]: Select the worst quality format represented by a
1291 single file with video and audio.
1292 \- \f[C]bestvideo\f[]: Select the best quality video\-only format (e.g.
1293 DASH video).
1294 May not be available.
1295 \- \f[C]worstvideo\f[]: Select the worst quality video\-only format.
1296 May not be available.
1297 \- \f[C]bestaudio\f[]: Select the best quality audio only\-format.
1298 May not be available.
1299 \- \f[C]worstaudio\f[]: Select the worst quality audio only\-format.
1300 May not be available.
1301 .PP
1302 For example, to download the worst quality video\-only format you can
1303 use \f[C]\-f\ worstvideo\f[].
1304 .PP
1305 If you want to download multiple videos and they don\[aq]t have the same
1306 formats available, you can specify the order of preference using
1307 slashes.
1308 Note that slash is left\-associative, i.e.
1309 formats on the left hand side are preferred, for example
1310 \f[C]\-f\ 22/17/18\f[] will download format 22 if it\[aq]s available,
1311 otherwise it will download format 17 if it\[aq]s available, otherwise it
1312 will download format 18 if it\[aq]s available, otherwise it will
1313 complain that no suitable formats are available for download.
1314 .PP
1315 If you want to download several formats of the same video use a comma as
1316 a separator, e.g.
1317 \f[C]\-f\ 22,17,18\f[] will download all these three formats, of course
1318 if they are available.
1319 Or a more sophisticated example combined with the precedence feature:
1320 \f[C]\-f\ 136/137/mp4/bestvideo,140/m4a/bestaudio\f[].
1321 .PP
1322 You can also filter the video formats by putting a condition in
1323 brackets, as in \f[C]\-f\ "best[height=720]"\f[] (or
1324 \f[C]\-f\ "[filesize>10M]"\f[]).
1325 .PP
1326 The following numeric meta fields can be used with comparisons
1327 \f[C]<\f[], \f[C]<=\f[], \f[C]>\f[], \f[C]>=\f[], \f[C]=\f[] (equals),
1328 \f[C]!=\f[] (not equals): \- \f[C]filesize\f[]: The number of bytes, if
1329 known in advance \- \f[C]width\f[]: Width of the video, if known \-
1330 \f[C]height\f[]: Height of the video, if known \- \f[C]tbr\f[]: Average
1331 bitrate of audio and video in KBit/s \- \f[C]abr\f[]: Average audio
1332 bitrate in KBit/s \- \f[C]vbr\f[]: Average video bitrate in KBit/s \-
1333 \f[C]asr\f[]: Audio sampling rate in Hertz \- \f[C]fps\f[]: Frame rate
1334 .PP
1335 Also filtering work for comparisons \f[C]=\f[] (equals), \f[C]!=\f[]
1336 (not equals), \f[C]^=\f[] (begins with), \f[C]$=\f[] (ends with),
1337 \f[C]*=\f[] (contains) and following string meta fields: \-
1338 \f[C]ext\f[]: File extension \- \f[C]acodec\f[]: Name of the audio codec
1339 in use \- \f[C]vcodec\f[]: Name of the video codec in use \-
1340 \f[C]container\f[]: Name of the container format \- \f[C]protocol\f[]:
1341 The protocol that will be used for the actual download, lower\-case
1342 (\f[C]http\f[], \f[C]https\f[], \f[C]rtsp\f[], \f[C]rtmp\f[],
1343 \f[C]rtmpe\f[], \f[C]mms\f[], \f[C]f4m\f[], \f[C]ism\f[],
1344 \f[C]http_dash_segments\f[], \f[C]m3u8\f[], or \f[C]m3u8_native\f[]) \-
1345 \f[C]format_id\f[]: A short description of the format
1346 .PP
1347 Note that none of the aforementioned meta fields are guaranteed to be
1348 present since this solely depends on the metadata obtained by particular
1349 extractor, i.e.
1350 the metadata offered by the video hoster.
1351 .PP
1352 Formats for which the value is not known are excluded unless you put a
1353 question mark (\f[C]?\f[]) after the operator.
1354 You can combine format filters, so
1355 \f[C]\-f\ "[height\ <=?\ 720][tbr>500]"\f[] selects up to 720p videos
1356 (or videos where the height is not known) with a bitrate of at least 500
1357 KBit/s.
1358 .PP
1359 You can merge the video and audio of two formats into a single file
1360 using \f[C]\-f\ <video\-format>+<audio\-format>\f[] (requires ffmpeg or
1361 avconv installed), for example \f[C]\-f\ bestvideo+bestaudio\f[] will
1362 download the best video\-only format, the best audio\-only format and
1363 mux them together with ffmpeg/avconv.
1364 .PP
1365 Format selectors can also be grouped using parentheses, for example if
1366 you want to download the best mp4 and webm formats with a height lower
1367 than 480 you can use \f[C]\-f\ \[aq](mp4,webm)[height<480]\[aq]\f[].
1368 .PP
1369 Since the end of April 2015 and version 2015.04.26, youtube\-dl uses
1370 \f[C]\-f\ bestvideo+bestaudio/best\f[] as the default format selection
1371 (see #5447 (https://github.com/rg3/youtube-dl/issues/5447),
1372 #5456 (https://github.com/rg3/youtube-dl/issues/5456)).
1373 If ffmpeg or avconv are installed this results in downloading
1374 \f[C]bestvideo\f[] and \f[C]bestaudio\f[] separately and muxing them
1375 together into a single file giving the best overall quality available.
1376 Otherwise it falls back to \f[C]best\f[] and results in downloading the
1377 best available quality served as a single file.
1378 \f[C]best\f[] is also needed for videos that don\[aq]t come from YouTube
1379 because they don\[aq]t provide the audio and video in two different
1380 files.
1381 If you want to only download some DASH formats (for example if you are
1382 not interested in getting videos with a resolution higher than 1080p),
1383 you can add \f[C]\-f\ bestvideo[height<=?1080]+bestaudio/best\f[] to
1384 your configuration file.
1385 Note that if you use youtube\-dl to stream to \f[C]stdout\f[] (and most
1386 likely to pipe it to your media player then), i.e.
1387 you explicitly specify output template as \f[C]\-o\ \-\f[], youtube\-dl
1388 still uses \f[C]\-f\ best\f[] format selection in order to start content
1389 delivery immediately to your player and not to wait until
1390 \f[C]bestvideo\f[] and \f[C]bestaudio\f[] are downloaded and muxed.
1391 .PP
1392 If you want to preserve the old format selection behavior (prior to
1393 youtube\-dl 2015.04.26), i.e.
1394 you want to download the best available quality media served as a single
1395 file, you should explicitly specify your choice with \f[C]\-f\ best\f[].
1396 You may want to add it to the configuration file (#configuration) in
1397 order not to type it every time you run youtube\-dl.
1398 .SS Format selection examples
1399 .PP
1400 Note that on Windows you may need to use double quotes instead of
1401 single.
1402 .IP
1403 .nf
1404 \f[C]
1405 #\ Download\ best\ mp4\ format\ available\ or\ any\ other\ best\ if\ no\ mp4\ available
1406 $\ youtube\-dl\ \-f\ \[aq]bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best\[aq]
1407
1408 #\ Download\ best\ format\ available\ but\ not\ better\ that\ 480p
1409 $\ youtube\-dl\ \-f\ \[aq]bestvideo[height<=480]+bestaudio/best[height<=480]\[aq]
1410
1411 #\ Download\ best\ video\ only\ format\ but\ no\ bigger\ than\ 50\ MB
1412 $\ youtube\-dl\ \-f\ \[aq]best[filesize<50M]\[aq]
1413
1414 #\ Download\ best\ format\ available\ via\ direct\ link\ over\ HTTP/HTTPS\ protocol
1415 $\ youtube\-dl\ \-f\ \[aq](bestvideo+bestaudio/best)[protocol^=http]\[aq]
1416
1417 #\ Download\ the\ best\ video\ format\ and\ the\ best\ audio\ format\ without\ merging\ them
1418 $\ youtube\-dl\ \-f\ \[aq]bestvideo,bestaudio\[aq]\ \-o\ \[aq]%(title)s.f%(format_id)s.%(ext)s\[aq]
1419 \f[]
1420 .fi
1421 .PP
1422 Note that in the last example, an output template is recommended as
1423 bestvideo and bestaudio may have the same file name.
1424 .SH VIDEO SELECTION
1425 .PP
1426 Videos can be filtered by their upload date using the options
1427 \f[C]\-\-date\f[], \f[C]\-\-datebefore\f[] or \f[C]\-\-dateafter\f[].
1428 They accept dates in two formats:
1429 .IP \[bu] 2
1430 Absolute dates: Dates in the format \f[C]YYYYMMDD\f[].
1431 .IP \[bu] 2
1432 Relative dates: Dates in the format
1433 \f[C](now|today)[+\-][0\-9](day|week|month|year)(s)?\f[]
1434 .PP
1435 Examples:
1436 .IP
1437 .nf
1438 \f[C]
1439 #\ Download\ only\ the\ videos\ uploaded\ in\ the\ last\ 6\ months
1440 $\ youtube\-dl\ \-\-dateafter\ now\-6months
1441
1442 #\ Download\ only\ the\ videos\ uploaded\ on\ January\ 1,\ 1970
1443 $\ youtube\-dl\ \-\-date\ 19700101
1444
1445 $\ #\ Download\ only\ the\ videos\ uploaded\ in\ the\ 200x\ decade
1446 $\ youtube\-dl\ \-\-dateafter\ 20000101\ \-\-datebefore\ 20091231
1447 \f[]
1448 .fi
1449 .SH FAQ
1450 .SS How do I update youtube\-dl?
1451 .PP
1452 If you\[aq]ve followed our manual installation
1453 instructions (https://rg3.github.io/youtube-dl/download.html), you can
1454 simply run \f[C]youtube\-dl\ \-U\f[] (or, on Linux,
1455 \f[C]sudo\ youtube\-dl\ \-U\f[]).
1456 .PP
1457 If you have used pip, a simple
1458 \f[C]sudo\ pip\ install\ \-U\ youtube\-dl\f[] is sufficient to update.
1459 .PP
1460 If you have installed youtube\-dl using a package manager like
1461 \f[I]apt\-get\f[] or \f[I]yum\f[], use the standard system update
1462 mechanism to update.
1463 Note that distribution packages are often outdated.
1464 As a rule of thumb, youtube\-dl releases at least once a month, and
1465 often weekly or even daily.
1466 Simply go to https://yt\-dl.org to find out the current version.
1467 Unfortunately, there is nothing we youtube\-dl developers can do if your
1468 distribution serves a really outdated version.
1469 You can (and should) complain to your distribution in their bugtracker
1470 or support forum.
1471 .PP
1472 As a last resort, you can also uninstall the version installed by your
1473 package manager and follow our manual installation instructions.
1474 For that, remove the distribution\[aq]s package, with a line like
1475 .IP
1476 .nf
1477 \f[C]
1478 sudo\ apt\-get\ remove\ \-y\ youtube\-dl
1479 \f[]
1480 .fi
1481 .PP
1482 Afterwards, simply follow our manual installation
1483 instructions (https://rg3.github.io/youtube-dl/download.html):
1484 .IP
1485 .nf
1486 \f[C]
1487 sudo\ wget\ https://yt\-dl.org/latest/youtube\-dl\ \-O\ /usr/local/bin/youtube\-dl
1488 sudo\ chmod\ a+x\ /usr/local/bin/youtube\-dl
1489 hash\ \-r
1490 \f[]
1491 .fi
1492 .PP
1493 Again, from then on you\[aq]ll be able to update with
1494 \f[C]sudo\ youtube\-dl\ \-U\f[].
1495 .SS youtube\-dl is extremely slow to start on Windows
1496 .PP
1497 Add a file exclusion for \f[C]youtube\-dl.exe\f[] in Windows Defender
1498 settings.
1499 .SS I\[aq]m getting an error
1500 \f[C]Unable\ to\ extract\ OpenGraph\ title\f[] on YouTube playlists
1501 .PP
1502 YouTube changed their playlist format in March 2014 and later on, so
1503 you\[aq]ll need at least youtube\-dl 2014.07.25 to download all YouTube
1504 videos.
1505 .PP
1506 If you have installed youtube\-dl with a package manager, pip, setup.py
1507 or a tarball, please use that to update.
1508 Note that Ubuntu packages do not seem to get updated anymore.
1509 Since we are not affiliated with Ubuntu, there is little we can do.
1510 Feel free to report
1511 bugs (https://bugs.launchpad.net/ubuntu/+source/youtube-dl/+filebug) to
1512 the Ubuntu packaging
1513 people (mailto:ubuntu-motu@lists.ubuntu.com?subject=outdated%20version%20of%20youtube-dl)
1514 \- all they have to do is update the package to a somewhat recent
1515 version.
1516 See above for a way to update.
1517 .SS I\[aq]m getting an error when trying to use output template:
1518 \f[C]error:\ using\ output\ template\ conflicts\ with\ using\ title,\ video\ ID\ or\ auto\ number\f[]
1519 .PP
1520 Make sure you are not using \f[C]\-o\f[] with any of these options
1521 \f[C]\-t\f[], \f[C]\-\-title\f[], \f[C]\-\-id\f[], \f[C]\-A\f[] or
1522 \f[C]\-\-auto\-number\f[] set in command line or in a configuration
1523 file.
1524 Remove the latter if any.
1525 .SS Do I always have to pass \f[C]\-citw\f[]?
1526 .PP
1527 By default, youtube\-dl intends to have the best options (incidentally,
1528 if you have a convincing case that these should be different, please
1529 file an issue where you explain that (https://yt-dl.org/bug)).
1530 Therefore, it is unnecessary and sometimes harmful to copy long option
1531 strings from webpages.
1532 In particular, the only option out of \f[C]\-citw\f[] that is regularly
1533 useful is \f[C]\-i\f[].
1534 .SS Can you please put the \f[C]\-b\f[] option back?
1535 .PP
1536 Most people asking this question are not aware that youtube\-dl now
1537 defaults to downloading the highest available quality as reported by
1538 YouTube, which will be 1080p or 720p in some cases, so you no longer
1539 need the \f[C]\-b\f[] option.
1540 For some specific videos, maybe YouTube does not report them to be
1541 available in a specific high quality format you\[aq]re interested in.
1542 In that case, simply request it with the \f[C]\-f\f[] option and
1543 youtube\-dl will try to download it.
1544 .SS I get HTTP error 402 when trying to download a video. What\[aq]s
1545 this?
1546 .PP
1547 Apparently YouTube requires you to pass a CAPTCHA test if you download
1548 too much.
1549 We\[aq]re considering to provide a way to let you solve the
1550 CAPTCHA (https://github.com/rg3/youtube-dl/issues/154), but at the
1551 moment, your best course of action is pointing a web browser to the
1552 youtube URL, solving the CAPTCHA, and restart youtube\-dl.
1553 .SS Do I need any other programs?
1554 .PP
1555 youtube\-dl works fine on its own on most sites.
1556 However, if you want to convert video/audio, you\[aq]ll need
1557 avconv (https://libav.org/) or ffmpeg (https://www.ffmpeg.org/).
1558 On some sites \- most notably YouTube \- videos can be retrieved in a
1559 higher quality format without sound.
1560 youtube\-dl will detect whether avconv/ffmpeg is present and
1561 automatically pick the best option.
1562 .PP
1563 Videos or video formats streamed via RTMP protocol can only be
1564 downloaded when rtmpdump (https://rtmpdump.mplayerhq.hu/) is installed.
1565 Downloading MMS and RTSP videos requires either
1566 mplayer (https://mplayerhq.hu/) or mpv (https://mpv.io/) to be
1567 installed.
1568 .SS I have downloaded a video but how can I play it?
1569 .PP
1570 Once the video is fully downloaded, use any video player, such as
1571 mpv (https://mpv.io/), vlc (https://www.videolan.org/) or
1572 mplayer (https://www.mplayerhq.hu/).
1573 .SS I extracted a video URL with \f[C]\-g\f[], but it does not play on
1574 another machine / in my web browser.
1575 .PP
1576 It depends a lot on the service.
1577 In many cases, requests for the video (to download/play it) must come
1578 from the same IP address and with the same cookies and/or HTTP headers.
1579 Use the \f[C]\-\-cookies\f[] option to write the required cookies into a
1580 file, and advise your downloader to read cookies from that file.
1581 Some sites also require a common user agent to be used, use
1582 \f[C]\-\-dump\-user\-agent\f[] to see the one in use by youtube\-dl.
1583 You can also get necessary cookies and HTTP headers from JSON output
1584 obtained with \f[C]\-\-dump\-json\f[].
1585 .PP
1586 It may be beneficial to use IPv6; in some cases, the restrictions are
1587 only applied to IPv4.
1588 Some services (sometimes only for a subset of videos) do not restrict
1589 the video URL by IP address, cookie, or user\-agent, but these are the
1590 exception rather than the rule.
1591 .PP
1592 Please bear in mind that some URL protocols are \f[B]not\f[] supported
1593 by browsers out of the box, including RTMP.
1594 If you are using \f[C]\-g\f[], your own downloader must support these as
1595 well.
1596 .PP
1597 If you want to play the video on a machine that is not running
1598 youtube\-dl, you can relay the video content from the machine that runs
1599 youtube\-dl.
1600 You can use \f[C]\-o\ \-\f[] to let youtube\-dl stream a video to
1601 stdout, or simply allow the player to download the files written by
1602 youtube\-dl in turn.
1603 .SS ERROR: no fmt_url_map or conn information found in video info
1604 .PP
1605 YouTube has switched to a new video info format in July 2011 which is
1606 not supported by old versions of youtube\-dl.
1607 See above (#how-do-i-update-youtube-dl) for how to update youtube\-dl.
1608 .SS ERROR: unable to download video
1609 .PP
1610 YouTube requires an additional signature since September 2012 which is
1611 not supported by old versions of youtube\-dl.
1612 See above (#how-do-i-update-youtube-dl) for how to update youtube\-dl.
1613 .SS Video URL contains an ampersand and I\[aq]m getting some strange
1614 output \f[C][1]\ 2839\f[] or
1615 \f[C]\[aq]v\[aq]\ is\ not\ recognized\ as\ an\ internal\ or\ external\ command\f[]
1616 .PP
1617 That\[aq]s actually the output from your shell.
1618 Since ampersand is one of the special shell characters it\[aq]s
1619 interpreted by the shell preventing you from passing the whole URL to
1620 youtube\-dl.
1621 To disable your shell from interpreting the ampersands (or any other
1622 special characters) you have to either put the whole URL in quotes or
1623 escape them with a backslash (which approach will work depends on your
1624 shell).
1625 .PP
1626 For example if your URL is
1627 https://www.youtube.com/watch?t=4&v=BaW_jenozKc you should end up with
1628 following command:
1629 .PP
1630 \f[C]youtube\-dl\ \[aq]https://www.youtube.com/watch?t=4&v=BaW_jenozKc\[aq]\f[]
1631 .PP
1632 or
1633 .PP
1634 \f[C]youtube\-dl\ https://www.youtube.com/watch?t=4\\&v=BaW_jenozKc\f[]
1635 .PP
1636 For Windows you have to use the double quotes:
1637 .PP
1638 \f[C]youtube\-dl\ "https://www.youtube.com/watch?t=4&v=BaW_jenozKc"\f[]
1639 .SS ExtractorError: Could not find JS function u\[aq]OF\[aq]
1640 .PP
1641 In February 2015, the new YouTube player contained a character sequence
1642 in a string that was misinterpreted by old versions of youtube\-dl.
1643 See above (#how-do-i-update-youtube-dl) for how to update youtube\-dl.
1644 .SS HTTP Error 429: Too Many Requests or 402: Payment Required
1645 .PP
1646 These two error codes indicate that the service is blocking your IP
1647 address because of overuse.
1648 Contact the service and ask them to unblock your IP address, or \- if
1649 you have acquired a whitelisted IP address already \- use the
1650 \f[C]\-\-proxy\f[] or \f[C]\-\-source\-address\f[]
1651 options (#network-options) to select another IP address.
1652 .SS SyntaxError: Non\-ASCII character
1653 .PP
1654 The error
1655 .IP
1656 .nf
1657 \f[C]
1658 File\ "youtube\-dl",\ line\ 2
1659 SyntaxError:\ Non\-ASCII\ character\ \[aq]\\x93\[aq]\ ...
1660 \f[]
1661 .fi
1662 .PP
1663 means you\[aq]re using an outdated version of Python.
1664 Please update to Python 2.6 or 2.7.
1665 .SS What is this binary file? Where has the code gone?
1666 .PP
1667 Since June 2012 (#342 (https://github.com/rg3/youtube-dl/issues/342))
1668 youtube\-dl is packed as an executable zipfile, simply unzip it (might
1669 need renaming to \f[C]youtube\-dl.zip\f[] first on some systems) or
1670 clone the git repository, as laid out above.
1671 If you modify the code, you can run it by executing the
1672 \f[C]__main__.py\f[] file.
1673 To recompile the executable, run \f[C]make\ youtube\-dl\f[].
1674 .SS The exe throws an error due to missing \f[C]MSVCR100.dll\f[]
1675 .PP
1676 To run the exe you need to install first the Microsoft Visual C++ 2010
1677 Redistributable Package
1678 (x86) (https://www.microsoft.com/en-US/download/details.aspx?id=5555).
1679 .SS On Windows, how should I set up ffmpeg and youtube\-dl? Where should
1680 I put the exe files?
1681 .PP
1682 If you put youtube\-dl and ffmpeg in the same directory that you\[aq]re
1683 running the command from, it will work, but that\[aq]s rather
1684 cumbersome.
1685 .PP
1686 To make a different directory work \- either for ffmpeg, or for
1687 youtube\-dl, or for both \- simply create the directory (say,
1688 \f[C]C:\\bin\f[], or \f[C]C:\\Users\\<User\ name>\\bin\f[]), put all the
1689 executables directly in there, and then set your PATH environment
1690 variable (https://www.java.com/en/download/help/path.xml) to include
1691 that directory.
1692 .PP
1693 From then on, after restarting your shell, you will be able to access
1694 both youtube\-dl and ffmpeg (and youtube\-dl will be able to find
1695 ffmpeg) by simply typing \f[C]youtube\-dl\f[] or \f[C]ffmpeg\f[], no
1696 matter what directory you\[aq]re in.
1697 .SS How do I put downloads into a specific folder?
1698 .PP
1699 Use the \f[C]\-o\f[] to specify an output template (#output-template),
1700 for example \f[C]\-o\ "/home/user/videos/%(title)s\-%(id)s.%(ext)s"\f[].
1701 If you want this for all of your downloads, put the option into your
1702 configuration file (#configuration).
1703 .SS How do I download a video starting with a \f[C]\-\f[]?
1704 .PP
1705 Either prepend \f[C]https://www.youtube.com/watch?v=\f[] or separate the
1706 ID from the options with \f[C]\-\-\f[]:
1707 .IP
1708 .nf
1709 \f[C]
1710 youtube\-dl\ \-\-\ \-wNyEUrxzFU
1711 youtube\-dl\ "https://www.youtube.com/watch?v=\-wNyEUrxzFU"
1712 \f[]
1713 .fi
1714 .SS How do I pass cookies to youtube\-dl?
1715 .PP
1716 Use the \f[C]\-\-cookies\f[] option, for example
1717 \f[C]\-\-cookies\ /path/to/cookies/file.txt\f[].
1718 .PP
1719 In order to extract cookies from browser use any conforming browser
1720 extension for exporting cookies.
1721 For example,
1722 cookies.txt (https://chrome.google.com/webstore/detail/cookiestxt/njabckikapfpffapmjgojcnbfjonfjfg)
1723 (for Chrome) or Export
1724 Cookies (https://addons.mozilla.org/en-US/firefox/addon/export-cookies/)
1725 (for Firefox).
1726 .PP
1727 Note that the cookies file must be in Mozilla/Netscape format and the
1728 first line of the cookies file must be either
1729 \f[C]#\ HTTP\ Cookie\ File\f[] or
1730 \f[C]#\ Netscape\ HTTP\ Cookie\ File\f[].
1731 Make sure you have correct newline
1732 format (https://en.wikipedia.org/wiki/Newline) in the cookies file and
1733 convert newlines if necessary to correspond with your OS, namely
1734 \f[C]CRLF\f[] (\f[C]\\r\\n\f[]) for Windows and \f[C]LF\f[]
1735 (\f[C]\\n\f[]) for Unix and Unix\-like systems (Linux, Mac OS, etc.).
1736 \f[C]HTTP\ Error\ 400:\ Bad\ Request\f[] when using \f[C]\-\-cookies\f[]
1737 is a good sign of invalid newline format.
1738 .PP
1739 Passing cookies to youtube\-dl is a good way to workaround login when a
1740 particular extractor does not implement it explicitly.
1741 Another use case is working around
1742 CAPTCHA (https://en.wikipedia.org/wiki/CAPTCHA) some websites require
1743 you to solve in particular cases in order to get access (e.g.
1744 YouTube, CloudFlare).
1745 .SS How do I stream directly to media player?
1746 .PP
1747 You will first need to tell youtube\-dl to stream media to stdout with
1748 \f[C]\-o\ \-\f[], and also tell your media player to read from stdin (it
1749 must be capable of this for streaming) and then pipe former to latter.
1750 For example, streaming to vlc (https://www.videolan.org/) can be
1751 achieved with:
1752 .IP
1753 .nf
1754 \f[C]
1755 youtube\-dl\ \-o\ \-\ "https://www.youtube.com/watch?v=BaW_jenozKcj"\ |\ vlc\ \-
1756 \f[]
1757 .fi
1758 .SS How do I download only new videos from a playlist?
1759 .PP
1760 Use download\-archive feature.
1761 With this feature you should initially download the complete playlist
1762 with \f[C]\-\-download\-archive\ /path/to/download/archive/file.txt\f[]
1763 that will record identifiers of all the videos in a special file.
1764 Each subsequent run with the same \f[C]\-\-download\-archive\f[] will
1765 download only new videos and skip all videos that have been downloaded
1766 before.
1767 Note that only successful downloads are recorded in the file.
1768 .PP
1769 For example, at first,
1770 .IP
1771 .nf
1772 \f[C]
1773 youtube\-dl\ \-\-download\-archive\ archive.txt\ "https://www.youtube.com/playlist?list=PLwiyx1dc3P2JR9N8gQaQN_BCvlSlap7re"
1774 \f[]
1775 .fi
1776 .PP
1777 will download the complete \f[C]PLwiyx1dc3P2JR9N8gQaQN_BCvlSlap7re\f[]
1778 playlist and create a file \f[C]archive.txt\f[].
1779 Each subsequent run will only download new videos if any:
1780 .IP
1781 .nf
1782 \f[C]
1783 youtube\-dl\ \-\-download\-archive\ archive.txt\ "https://www.youtube.com/playlist?list=PLwiyx1dc3P2JR9N8gQaQN_BCvlSlap7re"
1784 \f[]
1785 .fi
1786 .SS Should I add \f[C]\-\-hls\-prefer\-native\f[] into my config?
1787 .PP
1788 When youtube\-dl detects an HLS video, it can download it either with
1789 the built\-in downloader or ffmpeg.
1790 Since many HLS streams are slightly invalid and ffmpeg/youtube\-dl each
1791 handle some invalid cases better than the other, there is an option to
1792 switch the downloader if needed.
1793 .PP
1794 When youtube\-dl knows that one particular downloader works better for a
1795 given website, that downloader will be picked.
1796 Otherwise, youtube\-dl will pick the best downloader for general
1797 compatibility, which at the moment happens to be ffmpeg.
1798 This choice may change in future versions of youtube\-dl, with
1799 improvements of the built\-in downloader and/or ffmpeg.
1800 .PP
1801 In particular, the generic extractor (used when your website is not in
1802 the list of supported sites by
1803 youtube\-dl (https://rg3.github.io/youtube-dl/supportedsites.html)
1804 cannot mandate one specific downloader.
1805 .PP
1806 If you put either \f[C]\-\-hls\-prefer\-native\f[] or
1807 \f[C]\-\-hls\-prefer\-ffmpeg\f[] into your configuration, a different
1808 subset of videos will fail to download correctly.
1809 Instead, it is much better to file an issue (https://yt-dl.org/bug) or a
1810 pull request which details why the native or the ffmpeg HLS downloader
1811 is a better choice for your use case.
1812 .SS Can you add support for this anime video site, or site which shows
1813 current movies for free?
1814 .PP
1815 As a matter of policy (as well as legality), youtube\-dl does not
1816 include support for services that specialize in infringing copyright.
1817 As a rule of thumb, if you cannot easily find a video that the service
1818 is quite obviously allowed to distribute (i.e.
1819 that has been uploaded by the creator, the creator\[aq]s distributor, or
1820 is published under a free license), the service is probably unfit for
1821 inclusion to youtube\-dl.
1822 .PP
1823 A note on the service that they don\[aq]t host the infringing content,
1824 but just link to those who do, is evidence that the service should
1825 \f[B]not\f[] be included into youtube\-dl.
1826 The same goes for any DMCA note when the whole front page of the service
1827 is filled with videos they are not allowed to distribute.
1828 A "fair use" note is equally unconvincing if the service shows
1829 copyright\-protected videos in full without authorization.
1830 .PP
1831 Support requests for services that \f[B]do\f[] purchase the rights to
1832 distribute their content are perfectly fine though.
1833 If in doubt, you can simply include a source that mentions the
1834 legitimate purchase of content.
1835 .SS How can I speed up work on my issue?
1836 .PP
1837 (Also known as: Help, my important issue not being solved!) The
1838 youtube\-dl core developer team is quite small.
1839 While we do our best to solve as many issues as possible, sometimes that
1840 can take quite a while.
1841 To speed up your issue, here\[aq]s what you can do:
1842 .PP
1843 First of all, please do report the issue at our issue
1844 tracker (https://yt-dl.org/bugs).
1845 That allows us to coordinate all efforts by users and developers, and
1846 serves as a unified point.
1847 Unfortunately, the youtube\-dl project has grown too large to use
1848 personal email as an effective communication channel.
1849 .PP
1850 Please read the bug reporting instructions (#bugs) below.
1851 A lot of bugs lack all the necessary information.
1852 If you can, offer proxy, VPN, or shell access to the youtube\-dl
1853 developers.
1854 If you are able to, test the issue from multiple computers in multiple
1855 countries to exclude local censorship or misconfiguration issues.
1856 .PP
1857 If nobody is interested in solving your issue, you are welcome to take
1858 matters into your own hands and submit a pull request (or coerce/pay
1859 somebody else to do so).
1860 .PP
1861 Feel free to bump the issue from time to time by writing a small comment
1862 ("Issue is still present in youtube\-dl version ...from France, but
1863 fixed from Belgium"), but please not more than once a month.
1864 Please do not declare your issue as \f[C]important\f[] or
1865 \f[C]urgent\f[].
1866 .SS How can I detect whether a given URL is supported by youtube\-dl?
1867 .PP
1868 For one, have a look at the list of supported
1869 sites (docs/supportedsites.md).
1870 Note that it can sometimes happen that the site changes its URL scheme
1871 (say, from https://example.com/video/1234567 to
1872 https://example.com/v/1234567 ) and youtube\-dl reports an URL of a
1873 service in that list as unsupported.
1874 In that case, simply report a bug.
1875 .PP
1876 It is \f[I]not\f[] possible to detect whether a URL is supported or not.
1877 That\[aq]s because youtube\-dl contains a generic extractor which
1878 matches \f[B]all\f[] URLs.
1879 You may be tempted to disable, exclude, or remove the generic extractor,
1880 but the generic extractor not only allows users to extract videos from
1881 lots of websites that embed a video from another service, but may also
1882 be used to extract video from a service that it\[aq]s hosting itself.
1883 Therefore, we neither recommend nor support disabling, excluding, or
1884 removing the generic extractor.
1885 .PP
1886 If you want to find out whether a given URL is supported, simply call
1887 youtube\-dl with it.
1888 If you get no videos back, chances are the URL is either not referring
1889 to a video or unsupported.
1890 You can find out which by examining the output (if you run youtube\-dl
1891 on the console) or catching an \f[C]UnsupportedError\f[] exception if
1892 you run it from a Python program.
1893 .SH Why do I need to go through that much red tape when filing bugs?
1894 .PP
1895 Before we had the issue template, despite our extensive bug reporting
1896 instructions (#bugs), about 80% of the issue reports we got were
1897 useless, for instance because people used ancient versions hundreds of
1898 releases old, because of simple syntactic errors (not in youtube\-dl but
1899 in general shell usage), because the problem was already reported
1900 multiple times before, because people did not actually read an error
1901 message, even if it said "please install ffmpeg", because people did not
1902 mention the URL they were trying to download and many more simple,
1903 easy\-to\-avoid problems, many of whom were totally unrelated to
1904 youtube\-dl.
1905 .PP
1906 youtube\-dl is an open\-source project manned by too few volunteers, so
1907 we\[aq]d rather spend time fixing bugs where we are certain none of
1908 those simple problems apply, and where we can be reasonably confident to
1909 be able to reproduce the issue without asking the reporter repeatedly.
1910 As such, the output of \f[C]youtube\-dl\ \-v\ YOUR_URL_HERE\f[] is
1911 really all that\[aq]s required to file an issue.
1912 The issue template also guides you through some basic steps you can do,
1913 such as checking that your version of youtube\-dl is current.
1914 .SH DEVELOPER INSTRUCTIONS
1915 .PP
1916 Most users do not need to build youtube\-dl and can download the
1917 builds (https://rg3.github.io/youtube-dl/download.html) or get them from
1918 their distribution.
1919 .PP
1920 To run youtube\-dl as a developer, you don\[aq]t need to build anything
1921 either.
1922 Simply execute
1923 .IP
1924 .nf
1925 \f[C]
1926 python\ \-m\ youtube_dl
1927 \f[]
1928 .fi
1929 .PP
1930 To run the test, simply invoke your favorite test runner, or execute a
1931 test file directly; any of the following work:
1932 .IP
1933 .nf
1934 \f[C]
1935 python\ \-m\ unittest\ discover
1936 python\ test/test_download.py
1937 nosetests
1938 \f[]
1939 .fi
1940 .PP
1941 See item 6 of new extractor tutorial (#adding-support-for-a-new-site)
1942 for how to run extractor specific test cases.
1943 .PP
1944 If you want to create a build of youtube\-dl yourself, you\[aq]ll need
1945 .IP \[bu] 2
1946 python
1947 .IP \[bu] 2
1948 make (only GNU make is supported)
1949 .IP \[bu] 2
1950 pandoc
1951 .IP \[bu] 2
1952 zip
1953 .IP \[bu] 2
1954 nosetests
1955 .SS Adding support for a new site
1956 .PP
1957 If you want to add support for a new site, first of all \f[B]make
1958 sure\f[] this site is \f[B]not dedicated to copyright
1959 infringement (README.md#can-you-add-support-for-this-anime-video-site-or-site-which-shows-current-movies-for-free)\f[].
1960 youtube\-dl does \f[B]not support\f[] such sites thus pull requests
1961 adding support for them \f[B]will be rejected\f[].
1962 .PP
1963 After you have ensured this site is distributing its content legally,
1964 you can follow this quick list (assuming your service is called
1965 \f[C]yourextractor\f[]):
1966 .IP " 1." 4
1967 Fork this repository (https://github.com/rg3/youtube-dl/fork)
1968 .IP " 2." 4
1969 Check out the source code with:
1970 .RS 4
1971 .IP
1972 .nf
1973 \f[C]
1974 git\ clone\ git\@github.com:YOUR_GITHUB_USERNAME/youtube\-dl.git
1975 \f[]
1976 .fi
1977 .RE
1978 .IP " 3." 4
1979 Start a new git branch with
1980 .RS 4
1981 .IP
1982 .nf
1983 \f[C]
1984 cd\ youtube\-dl
1985 git\ checkout\ \-b\ yourextractor
1986 \f[]
1987 .fi
1988 .RE
1989 .IP " 4." 4
1990 Start with this simple template and save it to
1991 \f[C]youtube_dl/extractor/yourextractor.py\f[]:
1992 .RS 4
1993 .IP
1994 .nf
1995 \f[C]
1996 #\ coding:\ utf\-8
1997 from\ __future__\ import\ unicode_literals
1998
1999 from\ .common\ import\ InfoExtractor
2000
2001
2002 class\ YourExtractorIE(InfoExtractor):
2003 \ \ \ \ _VALID_URL\ =\ r\[aq]https?://(?:www\\.)?yourextractor\\.com/watch/(?P<id>[0\-9]+)\[aq]
2004 \ \ \ \ _TEST\ =\ {
2005 \ \ \ \ \ \ \ \ \[aq]url\[aq]:\ \[aq]https://yourextractor.com/watch/42\[aq],
2006 \ \ \ \ \ \ \ \ \[aq]md5\[aq]:\ \[aq]TODO:\ md5\ sum\ of\ the\ first\ 10241\ bytes\ of\ the\ video\ file\ (use\ \-\-test)\[aq],
2007 \ \ \ \ \ \ \ \ \[aq]info_dict\[aq]:\ {
2008 \ \ \ \ \ \ \ \ \ \ \ \ \[aq]id\[aq]:\ \[aq]42\[aq],
2009 \ \ \ \ \ \ \ \ \ \ \ \ \[aq]ext\[aq]:\ \[aq]mp4\[aq],
2010 \ \ \ \ \ \ \ \ \ \ \ \ \[aq]title\[aq]:\ \[aq]Video\ title\ goes\ here\[aq],
2011 \ \ \ \ \ \ \ \ \ \ \ \ \[aq]thumbnail\[aq]:\ r\[aq]re:^https?://.*\\.jpg$\[aq],
2012 \ \ \ \ \ \ \ \ \ \ \ \ #\ TODO\ more\ properties,\ either\ as:
2013 \ \ \ \ \ \ \ \ \ \ \ \ #\ *\ A\ value
2014 \ \ \ \ \ \ \ \ \ \ \ \ #\ *\ MD5\ checksum;\ start\ the\ string\ with\ md5:
2015 \ \ \ \ \ \ \ \ \ \ \ \ #\ *\ A\ regular\ expression;\ start\ the\ string\ with\ re:
2016 \ \ \ \ \ \ \ \ \ \ \ \ #\ *\ Any\ Python\ type\ (for\ example\ int\ or\ float)
2017 \ \ \ \ \ \ \ \ }
2018 \ \ \ \ }
2019
2020 \ \ \ \ def\ _real_extract(self,\ url):
2021 \ \ \ \ \ \ \ \ video_id\ =\ self._match_id(url)
2022 \ \ \ \ \ \ \ \ webpage\ =\ self._download_webpage(url,\ video_id)
2023
2024 \ \ \ \ \ \ \ \ #\ TODO\ more\ code\ goes\ here,\ for\ example\ ...
2025 \ \ \ \ \ \ \ \ title\ =\ self._html_search_regex(r\[aq]<h1>(.+?)</h1>\[aq],\ webpage,\ \[aq]title\[aq])
2026
2027 \ \ \ \ \ \ \ \ return\ {
2028 \ \ \ \ \ \ \ \ \ \ \ \ \[aq]id\[aq]:\ video_id,
2029 \ \ \ \ \ \ \ \ \ \ \ \ \[aq]title\[aq]:\ title,
2030 \ \ \ \ \ \ \ \ \ \ \ \ \[aq]description\[aq]:\ self._og_search_description(webpage),
2031 \ \ \ \ \ \ \ \ \ \ \ \ \[aq]uploader\[aq]:\ self._search_regex(r\[aq]<div[^>]+id="uploader"[^>]*>([^<]+)<\[aq],\ webpage,\ \[aq]uploader\[aq],\ fatal=False),
2032 \ \ \ \ \ \ \ \ \ \ \ \ #\ TODO\ more\ properties\ (see\ youtube_dl/extractor/common.py)
2033 \ \ \ \ \ \ \ \ }
2034 \f[]
2035 .fi
2036 .RE
2037 .IP " 5." 4
2038 Add an import in
2039 \f[C]youtube_dl/extractor/extractors.py\f[] (https://github.com/rg3/youtube-dl/blob/master/youtube_dl/extractor/extractors.py).
2040 .IP " 6." 4
2041 Run
2042 \f[C]python\ test/test_download.py\ TestDownload.test_YourExtractor\f[].
2043 This \f[I]should fail\f[] at first, but you can continually re\-run it
2044 until you\[aq]re done.
2045 If you decide to add more than one test, then rename \f[C]_TEST\f[] to
2046 \f[C]_TESTS\f[] and make it into a list of dictionaries.
2047 The tests will then be named \f[C]TestDownload.test_YourExtractor\f[],
2048 \f[C]TestDownload.test_YourExtractor_1\f[],
2049 \f[C]TestDownload.test_YourExtractor_2\f[], etc.
2050 Note that tests with \f[C]only_matching\f[] key in test\[aq]s dict are
2051 not counted in.
2052 .IP " 7." 4
2053 Have a look at
2054 \f[C]youtube_dl/extractor/common.py\f[] (https://github.com/rg3/youtube-dl/blob/master/youtube_dl/extractor/common.py)
2055 for possible helper methods and a detailed description of what your
2056 extractor should and may
2057 return (https://github.com/rg3/youtube-dl/blob/master/youtube_dl/extractor/common.py#L74-L252).
2058 Add tests and code for as many as you want.
2059 .IP " 8." 4
2060 Make sure your code follows youtube\-dl coding
2061 conventions (#youtube-dl-coding-conventions) and check the code with
2062 flake8 (https://pypi.python.org/pypi/flake8).
2063 Also make sure your code works under all
2064 Python (https://www.python.org/) versions claimed supported by
2065 youtube\-dl, namely 2.6, 2.7, and 3.2+.
2066 .IP " 9." 4
2067 When the tests pass, add (https://git-scm.com/docs/git-add) the new
2068 files and commit (https://git-scm.com/docs/git-commit) them and
2069 push (https://git-scm.com/docs/git-push) the result, like this:
2070 .RS 4
2071 .IP
2072 .nf
2073 \f[C]
2074 $\ git\ add\ youtube_dl/extractor/extractors.py
2075 $\ git\ add\ youtube_dl/extractor/yourextractor.py
2076 $\ git\ commit\ \-m\ \[aq][yourextractor]\ Add\ new\ extractor\[aq]
2077 $\ git\ push\ origin\ yourextractor
2078 \f[]
2079 .fi
2080 .RE
2081 .IP "10." 4
2082 Finally, create a pull
2083 request (https://help.github.com/articles/creating-a-pull-request).
2084 We\[aq]ll then review and merge it.
2085 .PP
2086 In any case, thank you very much for your contributions!
2087 .SS youtube\-dl coding conventions
2088 .PP
2089 This section introduces a guide lines for writing idiomatic, robust and
2090 future\-proof extractor code.
2091 .PP
2092 Extractors are very fragile by nature since they depend on the layout of
2093 the source data provided by 3rd party media hosters out of your control
2094 and this layout tends to change.
2095 As an extractor implementer your task is not only to write code that
2096 will extract media links and metadata correctly but also to minimize
2097 dependency on the source\[aq]s layout and even to make the code foresee
2098 potential future changes and be ready for that.
2099 This is important because it will allow the extractor not to break on
2100 minor layout changes thus keeping old youtube\-dl versions working.
2101 Even though this breakage issue is easily fixed by emitting a new
2102 version of youtube\-dl with a fix incorporated, all the previous
2103 versions become broken in all repositories and distros\[aq] packages
2104 that may not be so prompt in fetching the update from us.
2105 Needless to say, some non rolling release distros may never receive an
2106 update at all.
2107 .SS Mandatory and optional metafields
2108 .PP
2109 For extraction to work youtube\-dl relies on metadata your extractor
2110 extracts and provides to youtube\-dl expressed by an information
2111 dictionary (https://github.com/rg3/youtube-dl/blob/master/youtube_dl/extractor/common.py#L75-L257)
2112 or simply \f[I]info dict\f[].
2113 Only the following meta fields in the \f[I]info dict\f[] are considered
2114 mandatory for a successful extraction process by youtube\-dl:
2115 .IP \[bu] 2
2116 \f[C]id\f[] (media identifier)
2117 .IP \[bu] 2
2118 \f[C]title\f[] (media title)
2119 .IP \[bu] 2
2120 \f[C]url\f[] (media download URL) or \f[C]formats\f[]
2121 .PP
2122 In fact only the last option is technically mandatory (i.e.
2123 if you can\[aq]t figure out the download location of the media the
2124 extraction does not make any sense).
2125 But by convention youtube\-dl also treats \f[C]id\f[] and \f[C]title\f[]
2126 as mandatory.
2127 Thus the aforementioned metafields are the critical data that the
2128 extraction does not make any sense without and if any of them fail to be
2129 extracted then the extractor is considered completely broken.
2130 .PP
2131 Any
2132 field (https://github.com/rg3/youtube-dl/blob/master/youtube_dl/extractor/common.py#L149-L257)
2133 apart from the aforementioned ones are considered \f[B]optional\f[].
2134 That means that extraction should be \f[B]tolerant\f[] to situations
2135 when sources for these fields can potentially be unavailable (even if
2136 they are always available at the moment) and \f[B]future\-proof\f[] in
2137 order not to break the extraction of general purpose mandatory fields.
2138 .SS Example
2139 .PP
2140 Say you have some source dictionary \f[C]meta\f[] that you\[aq]ve
2141 fetched as JSON with HTTP request and it has a key \f[C]summary\f[]:
2142 .IP
2143 .nf
2144 \f[C]
2145 meta\ =\ self._download_json(url,\ video_id)
2146 \f[]
2147 .fi
2148 .PP
2149 Assume at this point \f[C]meta\f[]\[aq]s layout is:
2150 .IP
2151 .nf
2152 \f[C]
2153 {
2154 \ \ \ \ ...
2155 \ \ \ \ "summary":\ "some\ fancy\ summary\ text",
2156 \ \ \ \ ...
2157 }
2158 \f[]
2159 .fi
2160 .PP
2161 Assume you want to extract \f[C]summary\f[] and put it into the
2162 resulting info dict as \f[C]description\f[].
2163 Since \f[C]description\f[] is an optional meta field you should be ready
2164 that this key may be missing from the \f[C]meta\f[] dict, so that you
2165 should extract it like:
2166 .IP
2167 .nf
2168 \f[C]
2169 description\ =\ meta.get(\[aq]summary\[aq])\ \ #\ correct
2170 \f[]
2171 .fi
2172 .PP
2173 and not like:
2174 .IP
2175 .nf
2176 \f[C]
2177 description\ =\ meta[\[aq]summary\[aq]]\ \ #\ incorrect
2178 \f[]
2179 .fi
2180 .PP
2181 The latter will break extraction process with \f[C]KeyError\f[] if
2182 \f[C]summary\f[] disappears from \f[C]meta\f[] at some later time but
2183 with the former approach extraction will just go ahead with
2184 \f[C]description\f[] set to \f[C]None\f[] which is perfectly fine
2185 (remember \f[C]None\f[] is equivalent to the absence of data).
2186 .PP
2187 Similarly, you should pass \f[C]fatal=False\f[] when extracting optional
2188 data from a webpage with \f[C]_search_regex\f[],
2189 \f[C]_html_search_regex\f[] or similar methods, for instance:
2190 .IP
2191 .nf
2192 \f[C]
2193 description\ =\ self._search_regex(
2194 \ \ \ \ r\[aq]<span[^>]+id="title"[^>]*>([^<]+)<\[aq],
2195 \ \ \ \ webpage,\ \[aq]description\[aq],\ fatal=False)
2196 \f[]
2197 .fi
2198 .PP
2199 With \f[C]fatal\f[] set to \f[C]False\f[] if \f[C]_search_regex\f[]
2200 fails to extract \f[C]description\f[] it will emit a warning and
2201 continue extraction.
2202 .PP
2203 You can also pass \f[C]default=<some\ fallback\ value>\f[], for example:
2204 .IP
2205 .nf
2206 \f[C]
2207 description\ =\ self._search_regex(
2208 \ \ \ \ r\[aq]<span[^>]+id="title"[^>]*>([^<]+)<\[aq],
2209 \ \ \ \ webpage,\ \[aq]description\[aq],\ default=None)
2210 \f[]
2211 .fi
2212 .PP
2213 On failure this code will silently continue the extraction with
2214 \f[C]description\f[] set to \f[C]None\f[].
2215 That is useful for metafields that may or may not be present.
2216 .SS Provide fallbacks
2217 .PP
2218 When extracting metadata try to do so from multiple sources.
2219 For example if \f[C]title\f[] is present in several places, try
2220 extracting from at least some of them.
2221 This makes it more future\-proof in case some of the sources become
2222 unavailable.
2223 .SS Example
2224 .PP
2225 Say \f[C]meta\f[] from the previous example has a \f[C]title\f[] and you
2226 are about to extract it.
2227 Since \f[C]title\f[] is a mandatory meta field you should end up with
2228 something like:
2229 .IP
2230 .nf
2231 \f[C]
2232 title\ =\ meta[\[aq]title\[aq]]
2233 \f[]
2234 .fi
2235 .PP
2236 If \f[C]title\f[] disappears from \f[C]meta\f[] in future due to some
2237 changes on the hoster\[aq]s side the extraction would fail since
2238 \f[C]title\f[] is mandatory.
2239 That\[aq]s expected.
2240 .PP
2241 Assume that you have some another source you can extract \f[C]title\f[]
2242 from, for example \f[C]og:title\f[] HTML meta of a \f[C]webpage\f[].
2243 In this case you can provide a fallback scenario:
2244 .IP
2245 .nf
2246 \f[C]
2247 title\ =\ meta.get(\[aq]title\[aq])\ or\ self._og_search_title(webpage)
2248 \f[]
2249 .fi
2250 .PP
2251 This code will try to extract from \f[C]meta\f[] first and if it fails
2252 it will try extracting \f[C]og:title\f[] from a \f[C]webpage\f[].
2253 .SS Make regular expressions flexible
2254 .PP
2255 When using regular expressions try to write them fuzzy and flexible.
2256 .SS Example
2257 .PP
2258 Say you need to extract \f[C]title\f[] from the following HTML code:
2259 .IP
2260 .nf
2261 \f[C]
2262 <span\ style="position:\ absolute;\ left:\ 910px;\ width:\ 90px;\ float:\ right;\ z\-index:\ 9999;"\ class="title">some\ fancy\ title</span>
2263 \f[]
2264 .fi
2265 .PP
2266 The code for that task should look similar to:
2267 .IP
2268 .nf
2269 \f[C]
2270 title\ =\ self._search_regex(
2271 \ \ \ \ r\[aq]<span[^>]+class="title"[^>]*>([^<]+)\[aq],\ webpage,\ \[aq]title\[aq])
2272 \f[]
2273 .fi
2274 .PP
2275 Or even better:
2276 .IP
2277 .nf
2278 \f[C]
2279 title\ =\ self._search_regex(
2280 \ \ \ \ r\[aq]<span[^>]+class=(["\\\[aq]])title\\1[^>]*>(?P<title>[^<]+)\[aq],
2281 \ \ \ \ webpage,\ \[aq]title\[aq],\ group=\[aq]title\[aq])
2282 \f[]
2283 .fi
2284 .PP
2285 Note how you tolerate potential changes in the \f[C]style\f[]
2286 attribute\[aq]s value or switch from using double quotes to single for
2287 \f[C]class\f[] attribute:
2288 .PP
2289 The code definitely should not look like:
2290 .IP
2291 .nf
2292 \f[C]
2293 title\ =\ self._search_regex(
2294 \ \ \ \ r\[aq]<span\ style="position:\ absolute;\ left:\ 910px;\ width:\ 90px;\ float:\ right;\ z\-index:\ 9999;"\ class="title">(.*?)</span>\[aq],
2295 \ \ \ \ webpage,\ \[aq]title\[aq],\ group=\[aq]title\[aq])
2296 \f[]
2297 .fi
2298 .SS Use safe conversion functions
2299 .PP
2300 Wrap all extracted numeric data into safe functions from \f[C]utils\f[]:
2301 \f[C]int_or_none\f[], \f[C]float_or_none\f[].
2302 Use them for string to number conversions as well.
2303 .SH EMBEDDING YOUTUBE\-DL
2304 .PP
2305 youtube\-dl makes the best effort to be a good command\-line program,
2306 and thus should be callable from any programming language.
2307 If you encounter any problems parsing its output, feel free to create a
2308 report (https://github.com/rg3/youtube-dl/issues/new).
2309 .PP
2310 From a Python program, you can embed youtube\-dl in a more powerful
2311 fashion, like this:
2312 .IP
2313 .nf
2314 \f[C]
2315 from\ __future__\ import\ unicode_literals
2316 import\ youtube_dl
2317
2318 ydl_opts\ =\ {}
2319 with\ youtube_dl.YoutubeDL(ydl_opts)\ as\ ydl:
2320 \ \ \ \ ydl.download([\[aq]https://www.youtube.com/watch?v=BaW_jenozKc\[aq]])
2321 \f[]
2322 .fi
2323 .PP
2324 Most likely, you\[aq]ll want to use various options.
2325 For a list of options available, have a look at
2326 \f[C]youtube_dl/YoutubeDL.py\f[] (https://github.com/rg3/youtube-dl/blob/3e4cedf9e8cd3157df2457df7274d0c842421945/youtube_dl/YoutubeDL.py#L137-L312).
2327 For a start, if you want to intercept youtube\-dl\[aq]s output, set a
2328 \f[C]logger\f[] object.
2329 .PP
2330 Here\[aq]s a more complete example of a program that outputs only errors
2331 (and a short message after the download is finished), and
2332 downloads/converts the video to an mp3 file:
2333 .IP
2334 .nf
2335 \f[C]
2336 from\ __future__\ import\ unicode_literals
2337 import\ youtube_dl
2338
2339
2340 class\ MyLogger(object):
2341 \ \ \ \ def\ debug(self,\ msg):
2342 \ \ \ \ \ \ \ \ pass
2343
2344 \ \ \ \ def\ warning(self,\ msg):
2345 \ \ \ \ \ \ \ \ pass
2346
2347 \ \ \ \ def\ error(self,\ msg):
2348 \ \ \ \ \ \ \ \ print(msg)
2349
2350
2351 def\ my_hook(d):
2352 \ \ \ \ if\ d[\[aq]status\[aq]]\ ==\ \[aq]finished\[aq]:
2353 \ \ \ \ \ \ \ \ print(\[aq]Done\ downloading,\ now\ converting\ ...\[aq])
2354
2355
2356 ydl_opts\ =\ {
2357 \ \ \ \ \[aq]format\[aq]:\ \[aq]bestaudio/best\[aq],
2358 \ \ \ \ \[aq]postprocessors\[aq]:\ [{
2359 \ \ \ \ \ \ \ \ \[aq]key\[aq]:\ \[aq]FFmpegExtractAudio\[aq],
2360 \ \ \ \ \ \ \ \ \[aq]preferredcodec\[aq]:\ \[aq]mp3\[aq],
2361 \ \ \ \ \ \ \ \ \[aq]preferredquality\[aq]:\ \[aq]192\[aq],
2362 \ \ \ \ }],
2363 \ \ \ \ \[aq]logger\[aq]:\ MyLogger(),
2364 \ \ \ \ \[aq]progress_hooks\[aq]:\ [my_hook],
2365 }
2366 with\ youtube_dl.YoutubeDL(ydl_opts)\ as\ ydl:
2367 \ \ \ \ ydl.download([\[aq]https://www.youtube.com/watch?v=BaW_jenozKc\[aq]])
2368 \f[]
2369 .fi
2370 .SH BUGS
2371 .PP
2372 Bugs and suggestions should be reported at:
2373 <https://github.com/rg3/youtube-dl/issues>.
2374 Unless you were prompted to or there is another pertinent reason (e.g.
2375 GitHub fails to accept the bug report), please do not send bug reports
2376 via personal email.
2377 For discussions, join us in the IRC channel
2378 #youtube\-dl (irc://chat.freenode.net/#youtube-dl) on freenode
2379 (webchat (https://webchat.freenode.net/?randomnick=1&channels=youtube-dl)).
2380 .PP
2381 \f[B]Please include the full output of youtube\-dl when run with
2382 \f[C]\-v\f[]\f[], i.e.
2383 \f[B]add\f[] \f[C]\-v\f[] flag to \f[B]your command line\f[], copy the
2384 \f[B]whole\f[] output and post it in the issue body wrapped in ``` for
2385 better formatting.
2386 It should look similar to this:
2387 .IP
2388 .nf
2389 \f[C]
2390 $\ youtube\-dl\ \-v\ <your\ command\ line>
2391 [debug]\ System\ config:\ []
2392 [debug]\ User\ config:\ []
2393 [debug]\ Command\-line\ args:\ [u\[aq]\-v\[aq],\ u\[aq]https://www.youtube.com/watch?v=BaW_jenozKcj\[aq]]
2394 [debug]\ Encodings:\ locale\ cp1251,\ fs\ mbcs,\ out\ cp866,\ pref\ cp1251
2395 [debug]\ youtube\-dl\ version\ 2015.12.06
2396 [debug]\ Git\ HEAD:\ 135392e
2397 [debug]\ Python\ version\ 2.6.6\ \-\ Windows\-2003Server\-5.2.3790\-SP2
2398 [debug]\ exe\ versions:\ ffmpeg\ N\-75573\-g1d0487f,\ ffprobe\ N\-75573\-g1d0487f,\ rtmpdump\ 2.4
2399 [debug]\ Proxy\ map:\ {}
2400 \&...
2401 \f[]
2402 .fi
2403 .PP
2404 \f[B]Do not post screenshots of verbose logs; only plain text is
2405 acceptable.\f[]
2406 .PP
2407 The output (including the first lines) contains important debugging
2408 information.
2409 Issues without the full output are often not reproducible and therefore
2410 do not get solved in short order, if ever.
2411 .PP
2412 Please re\-read your issue once again to avoid a couple of common
2413 mistakes (you can and should use this as a checklist):
2414 .SS Is the description of the issue itself sufficient?
2415 .PP
2416 We often get issue reports that we cannot really decipher.
2417 While in most cases we eventually get the required information after
2418 asking back multiple times, this poses an unnecessary drain on our
2419 resources.
2420 Many contributors, including myself, are also not native speakers, so we
2421 may misread some parts.
2422 .PP
2423 So please elaborate on what feature you are requesting, or what bug you
2424 want to be fixed.
2425 Make sure that it\[aq]s obvious
2426 .IP \[bu] 2
2427 What the problem is
2428 .IP \[bu] 2
2429 How it could be fixed
2430 .IP \[bu] 2
2431 How your proposed solution would look like
2432 .PP
2433 If your report is shorter than two lines, it is almost certainly missing
2434 some of these, which makes it hard for us to respond to it.
2435 We\[aq]re often too polite to close the issue outright, but the missing
2436 info makes misinterpretation likely.
2437 As a committer myself, I often get frustrated by these issues, since the
2438 only possible way for me to move forward on them is to ask for
2439 clarification over and over.
2440 .PP
2441 For bug reports, this means that your report should contain the
2442 \f[I]complete\f[] output of youtube\-dl when called with the
2443 \f[C]\-v\f[] flag.
2444 The error message you get for (most) bugs even says so, but you would
2445 not believe how many of our bug reports do not contain this information.
2446 .PP
2447 If your server has multiple IPs or you suspect censorship, adding
2448 \f[C]\-\-call\-home\f[] may be a good idea to get more diagnostics.
2449 If the error is \f[C]ERROR:\ Unable\ to\ extract\ ...\f[] and you cannot
2450 reproduce it from multiple countries, add \f[C]\-\-dump\-pages\f[]
2451 (warning: this will yield a rather large output, redirect it to the file
2452 \f[C]log.txt\f[] by adding \f[C]>log.txt\ 2>&1\f[] to your
2453 command\-line) or upload the \f[C]\&.dump\f[] files you get when you add
2454 \f[C]\-\-write\-pages\f[] somewhere (https://gist.github.com/).
2455 .PP
2456 \f[B]Site support requests must contain an example URL\f[].
2457 An example URL is a URL you might want to download, like
2458 \f[C]https://www.youtube.com/watch?v=BaW_jenozKc\f[].
2459 There should be an obvious video present.
2460 Except under very special circumstances, the main page of a video
2461 service (e.g.
2462 \f[C]https://www.youtube.com/\f[]) is \f[I]not\f[] an example URL.
2463 .SS Are you using the latest version?
2464 .PP
2465 Before reporting any issue, type \f[C]youtube\-dl\ \-U\f[].
2466 This should report that you\[aq]re up\-to\-date.
2467 About 20% of the reports we receive are already fixed, but people are
2468 using outdated versions.
2469 This goes for feature requests as well.
2470 .SS Is the issue already documented?
2471 .PP
2472 Make sure that someone has not already opened the issue you\[aq]re
2473 trying to open.
2474 Search at the top of the window or browse the GitHub
2475 Issues (https://github.com/rg3/youtube-dl/search?type=Issues) of this
2476 repository.
2477 If there is an issue, feel free to write something along the lines of
2478 "This affects me as well, with version 2015.01.01.
2479 Here is some more information on the issue: ...".
2480 While some issues may be old, a new post into them often spurs rapid
2481 activity.
2482 .SS Why are existing options not enough?
2483 .PP
2484 Before requesting a new feature, please have a quick peek at the list of
2485 supported
2486 options (https://github.com/rg3/youtube-dl/blob/master/README.md#options).
2487 Many feature requests are for features that actually exist already!
2488 Please, absolutely do show off your work in the issue report and detail
2489 how the existing similar options do \f[I]not\f[] solve your problem.
2490 .SS Is there enough context in your bug report?
2491 .PP
2492 People want to solve problems, and often think they do us a favor by
2493 breaking down their larger problems (e.g.
2494 wanting to skip already downloaded files) to a specific request (e.g.
2495 requesting us to look whether the file exists before downloading the
2496 info page).
2497 However, what often happens is that they break down the problem into two
2498 steps: One simple, and one impossible (or extremely complicated one).
2499 .PP
2500 We are then presented with a very complicated request when the original
2501 problem could be solved far easier, e.g.
2502 by recording the downloaded video IDs in a separate file.
2503 To avoid this, you must include the greater context where it is
2504 non\-obvious.
2505 In particular, every feature request that does not consist of adding
2506 support for a new site should contain a use case scenario that explains
2507 in what situation the missing feature would be useful.
2508 .SS Does the issue involve one problem, and one problem only?
2509 .PP
2510 Some of our users seem to think there is a limit of issues they can or
2511 should open.
2512 There is no limit of issues they can or should open.
2513 While it may seem appealing to be able to dump all your issues into one
2514 ticket, that means that someone who solves one of your issues cannot
2515 mark the issue as closed.
2516 Typically, reporting a bunch of issues leads to the ticket lingering
2517 since nobody wants to attack that behemoth, until someone mercifully
2518 splits the issue into multiple ones.
2519 .PP
2520 In particular, every site support request issue should only pertain to
2521 services at one site (generally under a common domain, but always using
2522 the same backend technology).
2523 Do not request support for vimeo user videos, White house podcasts, and
2524 Google Plus pages in the same issue.
2525 Also, make sure that you don\[aq]t post bug reports alongside feature
2526 requests.
2527 As a rule of thumb, a feature request does not include outputs of
2528 youtube\-dl that are not immediately related to the feature at hand.
2529 Do not post reports of a network error alongside the request for a new
2530 video service.
2531 .SS Is anyone going to need the feature?
2532 .PP
2533 Only post features that you (or an incapacitated friend you can
2534 personally talk to) require.
2535 Do not post features because they seem like a good idea.
2536 If they are really useful, they will be requested by someone who
2537 requires them.
2538 .SS Is your question about youtube\-dl?
2539 .PP
2540 It may sound strange, but some bug reports we receive are completely
2541 unrelated to youtube\-dl and relate to a different, or even the
2542 reporter\[aq]s own, application.
2543 Please make sure that you are actually using youtube\-dl.
2544 If you are using a UI for youtube\-dl, report the bug to the maintainer
2545 of the actual application providing the UI.
2546 On the other hand, if your UI for youtube\-dl fails in some way you
2547 believe is related to youtube\-dl, by all means, go ahead and report the
2548 bug.
2549 .SH COPYRIGHT
2550 .PP
2551 youtube\-dl is released into the public domain by the copyright holders.
2552 .PP
2553 This README file was originally written by Daniel
2554 Bolton (https://github.com/dbbolton) and is likewise released into the
2555 public domain.