Remove broken ehrensenf support
[clive.git] / man1 / clive.1.pod
blob9dd47e59bee5d19a5c7582edbda38b6fd733d690
2 =head1 NAME
4 clive - command line video extraction utility
6 =head1 SYNOPSIS
8 clive [options]... [URL]...
10 =head1 DESCRIPTION
12 clive is a command line video extraction utility for Youtube and other similar
13 video-sharing websites. It was written to work around the Adobe Flash plugin
14 requirement as the technology is poorly supported on Unix-like systems.
16 clive is not an universal video extraction utility. In fact, it supports only
17 a number of video websites. Each website typically exposes access to the video
18 content in a very different way, meaning that clive has to be customized for
19 each website in order to download any videos from them.
21 =head1 OPTION SYNTAX
23 You may freely mix different option styles and specify options after
24 the command line arguments, e.g.:
25   % clive -c URL --format=best
27 You may also put several options together that do not require arguments:
28   % clive -cnrf best URL
30 Note that the "dashed" options have aliases. For example:
31   % clive --no-extract --no_extract --noextract
32   % clive --cache-read --cache_read --cacheread
34 =head1 OPTIONS
36 =over 4
38 =item B<-h, --help>
40 Print help and exit.
42 =item B<-v, --version>
44 Print version and exit.
46 =item B<--hosts>
48 Print supported hosts with available formats and exit.
50 =item B<--upgrade-config>
52 Upgrade clive 2.0/2.1 config to current 2.2+ format and exit.
54 =item B<-l, --last>
56 Re-feed the previously fed video page links from the last run time.
58 =item B<--last-file>=I<path>
60 Use I<path> instead of the default path. See also L</FILES>.
62 =back
64 B<Output options>
66 =over 4
68 =item B<--emit-csv>
70 Print (or emit) video details in CSV format to standard output.
71 Implies --no-extract.
73 =item B<--print-fname>
75 Print filename on a separate line before download starts.
77 =item B<--debug>
79 Print cURL debug (or verbose) messages to standard error.
81 =item B<-q, --quiet>
83 Turn off all output to standard output and error.
85 =item B<--stderr>
87 Direct all output to standard error.
89 =back
91 B<HTTP Options>
93 =over 4
95 =item B<--agent>=I<string>
97 Identify clive as I<string> to HTTP servers. Defaults to "Mozilla/5.0".
99 =item B<--connect-timeout>=I<seconds>
101 Maximum time in I<seconds> allowed for connection to take. Defaults to 30.
103 =item B<--connect-timeout-socks>=I<seconds>
105 Same as above but tries to workaround the SOCKS proxy bug in cURL.
106 Defaults to 30.
108 =item B<--proxy>=I<address>
110 Use I<address> for HTTP proxy. Example: "http://foo:1234".
112 =item B<--no-proxy>
114 Disable all use of HTTP proxy, even if http_proxy environment variable is set.
116 =item B<--cookie-jar>=I<file>
118 Enable cookies, which are otherwise rejected by default, and have libcurl
119 to write them to I<file>. Specify "-" to instead to have the cookies written
120 to stdout.
122 =back
124 B<Cache Options>
126 =over 4
128 =item B<--cache-file>=I<path>
130 Use I<path> instead of the default path. See L</FILES>.
132 =item B<-r, --cache-read>
134 Read video details from cache record if it exists. Allows clive to
135 skip video page fetching and parsing again. See L</CACHE> section for more
136 on this.
138 =item B<-d, --cache-dump>
140 Dump cache records to standard output.
142 =item B<--cache-dump-format>=I<format-string>
144 Used to format the output of the above. Defaults to "%n: %t [%f, %mMB]".
146 Example:
147   % clive --cache-dump --cache-dump-format="%d: %t"
149 Supported format specifiers:
150   %t .. video page title
151   %i .. video id
152   %h .. video host
153   %l .. video file length (bytes)
154   %m .. video file length (MB)
155   %d .. date (last update)
156   %T .. time (last update)
157   %s .. time stamp (same as "%d %T")
158   %f .. video file format
159   %n .. index
161 =item B<--cache-grep>=I<pattern>
163 Grep stored cache records for I<pattern>. See also L</EXAMPLES - ADVANCED USE>.
165 =item B<-i, --cache-ignore-case>
167 Ignore case-differences while matching records.
169 =item B<-D, --cache-remove-record>
171 Remove matched records from cache.
173 =item B<--cache-clear>
175 Truncate cache records.
177 =item B<--no-cache>
179 Disable all (read and write) cache use.
181 =back
183 B<Download Options>
185 =over 4
187 =item B<-f, --format>=I<format>
189 Download the I<format> of the video. If I<format> is set to I<best>, clive
190 will attempt to download the best quality of the video.
192 If this option is not used (or is used with "default"), clive will
193 attempt to download whatever is assumed to be the default format
194 for the website.
196 Note also that each I<format> is specific to a website. See
197 L</FORMATS> for more.
199 =item B<-n, --no-extract>
201 Do not extract the video. In other words: simulate only to the point
202 that clive verifies the video link after fetching and parsing the
203 video page.
205 =item B<-O, --output-file>=I<file>
207 Write video to I<file>. Overwrites an already existing file.
209 Do not use this option when you are downloading more than one video
210  on one go.
212 See also the note below.
214 =item B<-c, --continue>
216 Continue partially downloaded video file.
218 Note that, by default, clive appends a numeric suffix to the filename
219 if the file exists already. That is unless:
221   * file is already completely retrieved, or:
222   * -c or -O is used
224 =item B<--save-dir>=I<dir>
226 Save extracted videos to I<dir>. clive defaults to the current working
227 directory.
229 =item B<--cclass>=I<class>
231 Use character-I<class> to filter video page titles. Defaults to "\w".
232 This is a Perl regular expression character class. For example:
233 "[A-Za-z0-9]".
235 =item B<-C, --no-cclass>
237 Disables the use of B<--cclass>. Causes clive to use the video page
238 title as it is for output filename.
240 =item B<--filename-format>=I<format-string>
242 Use I<format-string> to format output video filenames. Default is "%t.%s".
244 Supported format specifiers:
245   %t .. video page title (after applying character-class filter)
246   %s .. video file suffix (e.g. "flv")
247   %i .. video id
248   %h .. video host
250 =item B<--exec>=I<command>;
252 Defines the I<command> to run when video file transfer completes.
253 Note that B<--exec-run> must be used to actually cause clive
254 to invoke the defined I<command>.
256 Optional arguments may be passed to the command. The expression must be
257 terminated by a semicolon (";"). If the specifier "%i" appears anywhere
258 in the I<command>, it is replaced by the pathname of the extracted
259 video file.
261 =item B<--exec>=I<command>+
263 Same as above but "%i" is replaced with as many path names as
264 possible for the invocation of I<command>.
266 =item B<-e, --exec-run>
268 Causes clive to invoke the command defined with B<--exec> when
269 transfer finishes.
271 =item B<--stream-exec>=I<command>
273 Define the command to be invoked with B<--stream> and B<--stream-pass>.
274 If a "%i" specifier is used in the I<command>, it will be replaced with
275 either video file path name (B<--stream>) or parsed video link
276 (B<--stream-pass>).
278 =item B<--stream>=I<percent>
280 Causes clive to fetch, parse, start download and eventually invoke
281 the command defined with B<--stream-exec> when the transfer reaches
282 the percentage defined with this option. See also L</EXAMPLES>.
284 Note that clive does nothing to check if there is enough data buffered
285 before invoking the B<--stream-exec> defined I<command>. If the transfer
286 rate drops significantly after starting the process and it runs out of data,
287 clive does nothing to fix this.
289 Also note that clive will not continue to download another file before the
290 child process exits.
292 This mode is supported for historical reasons. Consider using
293 B<--stream-pass> instead.
295 =item B<-s, --stream-pass>
297 Otherwise the same as above but B<instead of> starting the download,
298 clive passes the parsed video link to the command defined with
299 B<--stream-exec>. See also L</EXAMPLES>.
301 This option was inspired by a C<clive(1)> wrapper script contributed
302 by Bill Squire.
304 =item B<--limit-rate>=I<amount>
306 Limit transfer rate to I<amount> KB/s.
308 =item B<--stop-after>=I<size|percent>
310 Stop file transfer after I<size> or I<percent>. The value must
311 be terminated by either '%' or 'M'.
313 =back
315 =head1 EXAMPLES - BASIC USE
317 =over 4
319 =item clive "http://youtube.com/watch?v=3HD220e0bx4"
321 Extracts video (flv) from the above video page link. You
322 can then play the flv video file in a media player.
324 =item cat E<gt> url.lst
326   http://en.sevenload.com/videos/IUL3gda-Funny-Football-Clips
327   http://youtube.com/watch?v=3HD220e0bx4
328   http://break.com/index/beach-tackle-whip-lash.html
329   http://www.liveleak.com/view?i=704_1228511265
331 =item cat url.lst | clive
333 You can feed clive multiple video page links like this
334 or as command line arguments.
336 =item clive URL1 URL2 URL3 URL4
338 When you are using the pipes, be sure to separate each link with a newline.
340 =item xclip -o | clive
342 There are many X clipboard utilities. The above example uses C<xclip(1)>
343 and a pipe to paste (or feed) the contents to clive.
345 =item clive -l
347 Recall last video page link input. Regardless the way they were fed
348 to clive.
350 =back
352 =head1 EXAMPLES - ADVANCED USE
354 =over 4
356 =item clive -f best "http://youtube.com/watch?v=3HD220e0bx4"
358 Extract the best format of the video.
360 =item clive -r -f best "http://youtube.com/watch?v=3HD220e0bx4"
362 Same as above but read the cache record without fetching and
363 parsing the video page again.
365 =item clive --cache-dump
367 Dump all cache records to stdout. You can use --cache-dump-format
368 to format the output.
370 =item clive -ig "hd"
372 Grep for "hd" pattern in cache records. If pattern matches, clive
373 continues to extract the matched videos. Note the use of "-i"
374 (--cache-ignore-case).
376 =item clive -ig "hd" -D
378 Same as above but removes the record from cache instead of extracting
379 the video.
381 =item clive --exec="ffmpeg -i %i -acodec libvorbis %i.ogg;" -e URL
383 Copy audio from downloaded video to ogg with C<ffmpeg(1)>.
385 =item clive --stream-exec="mplayer -really-quiet %i" --stream=25 URL
387 Start playing the video being extracted when the transfer reaches
388 25% complete.
390 =item echo '--stream-exec="mplayer -really-quiet %i"' >> ~/.cliverc
392 =item clive -s URL
394 Alternative to Adobe Flash. C<vlc(1)> and C<totem(1)> have been reported
395 to work also.
397 =back
399 =head1 FORMATS
401 Run the program with C<--hosts> to view the supported websites and
402 format IDs to be used with C<--format>.
404 =over 4
406 =item B<youtube.com>
408 For historical reasons, you can still use the following format IDs
409 with Youtube:
410   mp4, hd, hq, 3gp
412 Note however that the above IDs are considered deprecated and will be
413 removed in the future versions. Run clive with C<--hosts> to get a list
414 of the current IDs.
416 =back
418 =head1 FILES
420 Should HOME environment variable be undefined for some reason, clive will
421 use the current working directory instead.
423 =over 4
425 =item $HOME/.cliverc, $HOME/.clive/config, $HOME/.config/clive/config
427 User configuration file. For example:
428   % cat >> ~/.cliverc
429   -f best
430   --proxy=http://foo:1234
432 =item $HOME/.cache/clive/last
434 File containing the last user input (video page links).
436 You can use --last-file to override the path, e.g.:
437   --last-file=/path/to/last/file.
439 You can also define this option in the config file.
441 See also CLIVE_CACHE notes below.
443 =item $HOME/.cache/clive/cache
445 BerkeleyDB based cache file containing the records of fetched
446 and parsed video pages.
448 You can use --cache-file to override the path., e.g.:
449   --cache-file=/path/to/cache/file.
451 You can also define this option in the config file.
453 See also CLIVE_CACHE notes below.
455 =item Notes: CLIVE_CACHE
457 clive defaults to use $HOME/.cache/clive/ for "last" and
458 "cache" files described above.
460 The use of the default path can be overridden by
461 CLIVE_CACHE environment variable. Note that clive
462 will attempt to create the specified path recursively.
464 Examples:
465   setenv CLIVE_CACHE /home/user/cachedata (in csh terms)
466   clive # will read/write /home/user/cachedata/(last|cache)
468   unsetenv CLIVE_CACHE
469   clive # read/write $HOME/clive/(last|cache)
471   clive --last-file=mylast --cache-file=cachedata/mycache
472     # read/write "mylast" file, read/write cachedata/mycache file
474 =back
476 =head1 CACHE
478 The purpose of the cache is to allow clive to skip fetching
479 and parsing the video page again. It does not contain any
480 actual video data so one should not expect to recover a deleted
481 video file from the cache. Only some of the parsed details
482 are stored as records to the cache.
484 By now, it is should be a well known fact that the cache fails
485 with some of the supported hosts. For example Youtube video links
486 expire after some time, this causes the re-extraction to fail if
487 the cached video link is used later again.
489 This was the main reason why in 2.2.0 reading from cache was
490 disabled by default. Many users reported the reuse of expired
491 video links as a bug previously even though it was well documented
492 in the manual page explaining that most of the HTTP 403/404 errors
493 were actually caused by expired video links.
495 It is, of course, still possible to read from cache. You can
496 enable this by invoking the --cache-read option. This causes
497 clive to look up a saved cache record and reuse the stored
498 video details if they are found instead of fetching the video
499 page.
501 The use of the cache can be disabled with the --no-cache option.
502 This disables both read and write. Note that if the BerkeleyDB Perl
503 module is not installed, clive will not use the cache.
505 See also the --cache-grep option.
507 =head1 DEBUGGING
509 Amp up libcurl verbosity:
511   % clive --debug URL
513 Parse only, do not download the video:
515   % clive -n URL
517 =head1 EXIT STATUS
519 clive exits 0 on success, and E<gt>0 if an error occurs.
521  CLIVE_OK          = 0
522  CLIVE_NOTHINGTODO = 1    # file already retrieved
523  CLIVE_NOSUPPORT   = 2    # host not supported
524  CLIVE_READ        = 3    # file open/read error
525  CLIVE_GREP        = 4    # grep: nothing matched in cache
526  CLIVE_OPTARG      = 5    # invalid option argument
527  CLIVE_SYSTEM      = 6    # system call failed (e.g. fork)
528  CLIVE_REGEXP      = 7    # regexp pattern matching failed
529  CLIVE_FORMAT      = 8    # requested format unavailable
530  CLIVE_NET         = 9    # network error
531  CLIVE_STOP        = 10   # --stop-after
532  CLIVE_MARKEDBROKEN = 11  # support marked broken
534 =head1 WWW
536 <http://clive.sourceforge.net/>
538 =head1 SEE ALSO
540 C<cclive(1)>
542 =head1 AUTHOR
544 Toni Gundogdu <legatvs at sign gmail com>
546 Thanks to all those who have contributed to the project
547 by sending patches, reporting bugs and writing feedback.
548 You know who you are.
550 =cut