clive

Langue: en

Version: 2009-05-25 (debian - 07/07/09)

Section: 1 (Commandes utilisateur)

NAME

clive - the non-interactive video extraction utility

SYNOPSIS

clive [option]... [URL]...

DESCRIPTION

clive is a command line utility for extracting videos from Youtube and other video sharing Web sites. It was originally written to bypass the Adobe Flash requirement needed to view the hosted videos.

clive can be non-interactive. This means it can work in the background while the user is not logged on, allowing the user to start an extraction and disconnect from the system and letting clive finish the work.

clive was influenced by the GNU wget(1) utility. Kudos to the wget team for their original work.

OPTION SYNTAX

You may freely mix different option styles, or specify options after the command-line arguments. For example:
  % clive -c --format=mp4 URL -n

You may also put several options together that do not require arguments. For example:
  % clive -pcn URL

Which is equivalent to:
  % clive -p -c -n URL

OPTIONS

-h --help
Print this help and exit.
-v --version
Print version and exit.
--hosts
Print supported hosts and exit.
-b --background
Go to background immediately after startup. If no output file is specified using the --output or --append, the output is redirected to clive-log file. Implies --progress=dot.
-e --emit-csv
Do not extract any videos, instead print the video details as CSV to stdout. Ignores the --quiet option for CSV.
-E --emit-xml
Equivalent to --emit-csv in every way but the output is XML. Negates --emit-csv.
-V --clivepass=path
path to the clivepass(1) utility. If CLIVEPASS_PATH environment variable is set, it will will used.

HTTP options

-U --agent=string
Identify as string to the HTTP server. Defaults is ``Mozilla/5.0''.
-y --proxy=address
Use address for HTTP proxy, e.g. http://foo:1234. If undefined, uses the http_proxy environment setting if present.
-X --no-proxy
Do not use HTTP proxy.
--connect-timeout=seconds
Maximum time in seconds allowed the connection to the server to take. This limits only the connection phase. clive will only timeout on the system's internal timeouts by default.

http://curl.haxx.se/docs/knownbugs.html:

   "34. The SOCKS4 connection codes don't properly acknowledge
        (connect) timeouts. Also see #12. According to bug #1556528,
        even the SOCKS5 connect code does not do it right:
        http://curl.haxx.se/bug/view.cgi?id=1556528"
 
   "12. When connecting to a SOCKS proxy, the (connect) timeout
        is not properly acknowledged after the actual TCP connect
        (during the SOCKS 'negotiate' phase)."
 
 

See also --connect-timeout-socks.

--connect-timeout-socks=seconds
Same as --connect-timeout but works around the SOCKS proxy bug by using CURLOPT_TIMEOUT instead of CURLOPT_CONNECTIMEOUT.

Ignored for file transfers, otherwise curl could interrupt started transfers.

More about these curl options:
  http://curl.haxx.se/libcurl/c/curl_easy_setopt.html

Cache Options

-R --renew
Renew cache entries for the re-visited URLs. See ``CACHE'' in the manual page.
-s --show
Print all cache entries to standard output.
-H --show-format=string
Format printed entries using the string. Default is '%D: ``%t'' | %mMB'. The following specifiers are supported:
  %t = video page title
  %i = video id
  %l = video file length (bytes)
  %u = video page url
  %x = video extraction url
  %D = video extraction date
  %T = video extraction time
  %S = video extraction timestamp (same as: %D %T)
-g --grep=pattern
Grep cache entries for pattern. Matching is not restricted to any specific cache entry field (e.g. title or id).
  % clive --grep=git
  % clive --grep=^git --ignore-case

The matched entries are then extracted. To only show the matches, use the --show option. For example:
  % clive -sg ^git

-i --ignore-case
Causes clive to ignore case-differences with --grep.
-D --delete
Delete grep-matched entries from the cache. If used with the --show option, clive will prompt before deleting, e.g.:
  % clive -siDg ^git
-C --clear
Clear cache and exit.

Logging and Input Options

-o --output=logfile
Log all messages to logfile. The messages are normally reported to stdout and stderr.
-a --append=logfile
Append to logfile. This is the same as --output but appends to logfile instead of overwriting it. If the logfile does not exist, it is created.
-d --debug
Causes the program to print Curl debug messages.
-q --quiet
Turn off all output.
-r --recall
Recall the last input.
-T --savebatch=file
Save current URL batch to file.
-p --paste
Paste input from clipboard. The pasted URLs are expected to be separated with newlines.
--stderr
Redirect all input to stderr, even if no TTY is available.

Download Options

-O --output-file=file
Write extracted video file to file.
-n --no-extract
Do not actually extract any videos.
-c --continue
Continue extraction of a partially downloaded file. Note that this works only with HTTP servers that support the ``Range'' header. Ignored unless localfile < remotefile.

The ``requested range was not delivered'' error typically implies that the host does not allow continuing partially extracted video files. You will see this error if you attempt to continue a partially downloaded flv video from Youtube, for example.

-G --progress=type
Select the type of the progress indicator. Accepted types are ``bar'', ``dot'' and ``none''.

The ``bar'' indicator is used by default. It spews out some details indicating the status of retrieval. If the output is not a TTY, the ``dot'' bar will be used instead.

Use --progress=dot to switch to the ``dot'' display. It traces the retrieval by printing dots on the screen, each dot representing a fixed amount of downloaded data.

When using the dotted retrieval, you may also set the style by specifying the type as dot:style.
  --progress=dot:default
    each dot 1K, 10-dots clusters, 50-dots lines
  --progress=dot:binary
    each dot  8K, 16-dots clusters, 48-dots lines
  --progress=dot:mega
    each dot 64K,  8-dots clusters, 48-dots lines

Progress indication can be disabled completely by setting type to ``none''.

-u --youtube-user=username
Causes clive to log into Youtube as username. This is done before extraction, even if the batch does not contain any Youtube video links.
-t --youtube-pass=password
Use password for Youtube login. If undefined, clive prompts for it.
-L --no-login
Do not log into Youtube.
-S --savedir=dir
Save extracted videos to dir.
-f --format=format
Extract format of the video. All supported websites have at least the flv format available. See ``FORMATS'' for more.
-l --cclass=character-class
Use character-class to filter the video page titles. Default is \w. The filtered video page titles are used to name the extracted videos.
-N --filename-format=string
Use string to construct the name of the extracted video. Default is ``%t.%s''. The following specifiers are supported:
  %t = video title (after applying --cclass)
  %i = video id
  %d = video domain
  %s = video suffix
  %D = current date
  %T = current time
  %S = timestamp (same as %D %T)
-x --exec=command;
Execute command. Optional arguments may be passed to the command. The expression must be terminated by a semicolon (``;''). If the specifier ``%i'' appears anywhere in command name or the arguments it is replaced by the pathname of the extracted video file.

Example:
  % clive --exec=``mplayer %i;'' URL

-x, --exec=command+
Same as --exec, except that ``%i'' is replaced with as many pathnames as possible for the invocation of command.
--stream-exec=command
Execute command when file transfer progress reaches percent as defined with the --stream option. If a ``%i'' specifier is used in the command expression, it will be replaced with video pathname.

clive forks the command and continues with the transfer. Note that clive will not continue to download another file before the child process terminates.

Some players and formats may not work properly with this feature. mplayer(1) is known to work properly with most flv videos.

--stream=percent
Execute the command defined with the --stream-exec option when the file transfer progress reaches percent.

Example:
  % clive --stream-exec=``mplayer -really-quiet %i'' --stream=20 URL

Note that clive does nothing to check if there is enough data buffered before forking the stream process. If the transfer rate drops significantly after starting the process and it runs out of data, clive does nothing to fix this.

--limit-rate=amount
Limit video download rate to amount KB/s.

EXAMPLES

Typical use:
% clive ``http://youtube.com/watch?v=3HD220e0bx4''
Multiple video URLs:
% cat >> url.lst
  http://en.sevenload.com/videos/IUL3gda-Funny-Football-Clips
  http://youtube.com/watch?v=3HD220e0bx4
  http://break.com/index/beach-tackle-whip-lash.html
  http://www.liveleak.com/view?i=704_1228511265

% cat url.lst | clive

Combine input from multiple sources:
% clive -p URL URL2
Recall the last URL batch, extract mp4 video format:
% clive -rf mp4
Grep for the pattern in cache, extract matched videos:
% clive -g 3HD220e0bx4
Same as above but delete the matched entries from cache:
% clive -iDg ^3hd2

Note the use of -i (--ignore-case).

Print cache contents to stdout:
% clive -s
Combine matching and printing cache entries:
% clive -sig ^3hd2

Note that -s negates video extraction.

Match, redirect output to my.log, go to background:
% clive -big ^3hd2 -o my.log
Extract video from URL, re-encode audio to mp3:
% clive --exec=``ffmpeg -y -i %i %i.mpg;'' URL
Login to Youtube to extract a video:
% clive -u myusername -t mypassword URL

This isn't typically needed unless you are trying to extract videos flagged as mature content.

Use protected login password:
Otherwise same as above but the login info is saved to a clivepass password repository file. The saved passwords are encrypted.

Note that you will need to install the clive-utils for this. See the ``OTHER'' section for details.

Create new password repository:
  % clivepass --create

Add new login name ``myusername'':
  % clivepass --add myusername

Use the created login info from clive:
  % clive -u myusername -t - -V /usr/bin/clivepass URL

This causes clive to request for the login password for ``myusername'' from clivepass(1). The password is then used to login to Youtube before extracting the video from the URL.

FORMATS

clive defaults to extract the flv format unless the --format option is used. The requested format may not always be available. The server typically returns one of the HTTP/40x errors if the requested format is not available.

The quality of the video depends on the uploaded video quality. Each website typically recompresses the uploaded videos to 320x240 resolution (sometimes higher). Because this varies per video and website, you should treat the list below only as a rough reference of what formats should be available.

www.youtube.com
www.last.fm
Formats: (flv|mp4|fmt35|fmt22|fmt17|fmt6) Continue: Yes (except flv)

flv and mp4 are typically available, whereas others may or may not be available. For example the high-definition (HD) formats (35, 22) are currently available for a limited number of videos, which are usually explicitly as ``HD'' or ``720p''.

last.fm is known to wrap Youtube videos. clive can handle such last.fm video links.

video.google.com
Formats: (flv|mp4) Continue: Only mp4

The mp4 may not always be available. GoogleVideo mp4 are encoded using a different codec than Youtube mp4 videos. You can typically --stream-exec Youtube mp4 videos but this is not case with GoogleVideo mp4 videos. If you find a way, drop an email.

www.sevenload.com
Formats: flv Continue: Yes
www.break.com
Formats: flv Continue: Yes
www.liveleak.com
Formats: flv Continue: Yes
www.evisor.tv
Formats: flv Continue: Yes
www.dailymotion.com
Formats: (spark|spak-mini|vp6-hq|vp6-hd|vp6|h264) Continue: Yes

spark is the ``regular'' 320x240 flv. clive defaults to spark if requested format is not available.

tv.cctv.com
Formats: flv Continue: Yes
redtube.com
Formats: flv Continue: Yes

CACHE

The cache has two purposes:
1.
Keep reusable video data available for fast re-extraction.
2.
Keep a record of extracted videos.

Each cache entry contains information about a video, including, but not limited to, page title, file length and extraction URL. You can use the --grep option to match these details when you are searching for videos from the cache. See the ``EXAMPLES'' section for examples of how to do this.

Some entries may need to be renewed from time to time as certain websites have their extraction URLs expire after awhile. Youtube is an example of this. Youtube servers usually return the HTTP/410 error if the extraction URL has expired. You can use the --renew option to fix this.

Note that clive renews the cache entry automatically if the video format does not match the cached video format string. This is done for two reasons:

1.
Cached video extraction URL points to a different location
2.
Cached video file length is likely to be incorrect

FILES

clive searches the ~/.config/clive directory for the config file. You can override this by setting the CLIVE_HOME environment variable.
~/.config/clive/config
Configuration file for clive.
~/.config/clive/cache
Contains the cache entries of the visited URLs. A Berkeley DB (Hash) file.
~/.config/clive/recall
Contains the last URL batch. You can --recall this file.

EXIT STATUS

clive exits 0 on success, and >0 if an error occurs.

SEE ALSO

clivefeed(1) clivescan(1) clivepass(1)

OTHER

Homepage:
  <http://clive.sourceforge.net/>

Project page:
  <http://code.google.com/p/clive/>

Development repository can be cloned with:
  % git clone git://repo.or.cz/clive.git

For release announcements, subscribe to the project at:
  <http://freshmeat.net/projects/clive/>

Additional utilities (clive-utils):
  <http://code.google.com/p/clive-utils/>

AUTHOR

Written by Toni Gundogdu <legatvs@gmail.com>. For a list of contributors, please see the AUTHORS and the CHANGES files.