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