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