Httrack Users Guide (3.10)

By Fred Cohen


Background and Introduction

I started using httrack in mid-2000 and found it to be an excellent tool for imaging web sites. Various words are used to describe this process - from imaging to mirroring to snaking and so on. I will be using a variety of these words in my description.

I have used many such tools over the years, have performed many manual and semi-automatic operations of similar sorts, and written partial programs to do similar functions, but - at least for now - httrack seems to me to be the best option for this function.

The only problem I encountered when using httrack was that it is so rich with features that I could never really figure out precisely the right thing to do at any given point. I was using recepies rather than knowledge to get the job done - and I was pestering the authors for those recepies. After a few days of very helpful assistance from the authors I volunteered to write a users manual for httrack - and here it is. I hope it gets the job done.


Basics

Httrack is a program that gets information from the Internet, looks for pointers to other information, gets that information, and so forth. If you ask it to, and have enough disk space, it will try to make a copy of the whole Internet on your computer. While this may be the answer to Dilbert's boss when he asks to get a printout of the Internet for some legal document, for most of us, we want to get copies of just the right part of the Internet, and have them nicely organized for our use. This is where httrack does a great job. Here's a simple example:

httrack "http://www.all.net/" -O "/tmp/www.all.net" "+*.all.net/*" -v

In this example, we ask httrack to start the Universal Resource Locator (URL) http://www.all.net/ and store the results under the directory /tmp/www.all.net (the -O stands for “output to”) while not going beyond the bounds of all the files in the www.all.net domain and printing out any error messages along the way (-v means verbose). This is the most common way that I use httrack. Please note that this particular command might take you a while - and run you out of disk space.

This sort of a mirror image is not an identical copy of the original web site - in some ways it's better such as for local use - while in other ways it may be problematic - such as for legal use. This default mirroring method changes the URLs within the web site so that the references are made relative to the location the copy is stored in. This makes it very useful for navigating through the web site on your local machine with a web browser since most things will work as you would expect them to work. In this example, URLs that point outside of the www.all.net domain space will still point there, and if you encounter one, the web browser will try to get the data from that location.

For each of the issues discussed here - and many more - httrack has options to allow you to make different choices and get different results. This is one of the great things about httrack - and one of the the real major problems with using it without the knowledge of all that it can do. If you want to know all the things httrack can do, you might try typing:

httrack --help

Unfortunately, while this outputs a though list of options, it is somewhat less helpful it might be for those who don't know what the options all mean and haven't used them before. On the other hand, this is most useful for those who already know how to use the program but don't remember some obscure option that they haven't used for some time.

The rest of this manual is dedicated to detailing what you find in the help message and providing examples - lots and lots of examples... Here is what you get (page by page - use <enter> to move to the next page in the real program) if you type 'httrack --help':

>httrack --help
 HTTrack version 3.03BETAo4 (compiled Jul  1 2001)
    usage: ./httrack <URLs> [-option] [+<FILTERs>] [-<FILTERs>]
    with options listed below: (* is the default value)

General options:
  O  path for mirror/logfiles+cache (-O path_mirror[,path_cache_and_logfiles]) (--path <param>)
 %O  top path if no path defined (-O path_mirror[,path_cache_and_logfiles])

Action options:
  w *mirror web sites (--mirror)
  W  mirror web sites, semi-automatic (asks questions) (--mirror-wizard)
  g  just get files (saved in the current directory) (--get-files)
  i  continue an interrupted mirror using the cache
  Y   mirror ALL links located in the first level pages (mirror links) (--mirrorlinks)

Proxy options:
  P  proxy use (-P proxy:port or -P user:pass@proxy:port) (--proxy <param>)
 %f *use proxy for ftp (f0 don't use) (--httpproxy-ftp[=0])

Limits options:
  rN set the mirror depth to N (* r9999) (--depth[=N])
 %eN set the external links depth to N (* %e0) (--ext-depth[=N])
  mN maximum file length for a non-html file (--max-files[=N])
  mN,N'                  for non html (N) and html (N')
  MN maximum overall size that can be uploaded/scanned (--max-size[=N])
  EN maximum mirror time in seconds (60=1 minute, 3600=1 hour) (--max-time[=N])
  AN maximum transfer rate in bytes/seconds (1000=1kb/s max) (--max-rate[=N])
 %cN maximum number of connections/seconds (*%c10)
  GN pause transfer if N bytes reached, and wait until lock file is deleted (--max-pause[=N])

Flow control:
  cN number of multiple connections (*c8) (--sockets[=N])
  TN timeout, number of seconds after a non-responding link is shutdown (--timeout)
  RN number of retries, in case of timeout or non-fatal errors (*R1) (--retries[=N])
  JN traffic jam control, minimum transfert rate (bytes/seconds) tolerated for a link (--min-rate[=N])
  HN host is abandoned if: 0=never, 1=timeout, 2=slow, 3=timeout or slow (--host-control[=N])

Links options:
 %P *extended parsing, attempt to parse all links, even in unknown tags or Javascript (%P0 don't use) (--extended-parsing[=0])
  n  get non-html files 'near' an html file (ex: an image located outside) (--near)
  t  test all URLs (even forbidden ones) (--test)
 %L <file> add all URL located in this text file (one URL per line) (--list <param>)

Build options:
  NN structure type (0 *original structure, 1+: see below) (--structure[=N])
     or user defined structure (-N "%h%p/%n%q.%t")
  LN long names (L1 *long names / L0 8-3 conversion) (--long-names[=N])
  KN keep original links (e.g. http://www.adr/link) (K0 *relative link, K absolute links, K3 absolute URI links) (--keep-links[=N])
  x  replace external html links by error pages (--replace-external)
 %x  do not include any password for external password protected websites (%x0 include) (--no-passwords)
 %q *include query string for local files (useless, for information purpose only) (%q0 don't include) (--include-query-string)
  o *save the server's error pages (404..) (o0 discard them) (--generate-errors)
  X *purge old files after update (X0 keep delete) (--purge-old[=0])

Spider options:
  bN accept cookies in cookies.txt (0=do not accept,* 1=accept) (--cookies[=N])
  u  check document type if unknown (cgi,asp..) (u0 don't check, * u1 check but /, u2 check always) (--check-type[=N])
  j *parse scripts (j0 don't parse) (--parse-java[=N])
  sN follow robots.txt and meta robots tags (0=never,1=sometimes,* 2=always) (--robots[=N])
 %h  force HTTP/1.0 requests (reduce update features, only for old servers or proxies) (--http-10)
 %B  tolerant requests (accept bogus responses on some servers, but not standard!) (--tolerant)
 %s  update hacks: keep a file already on disk when its size matches, even on a first crawl, and accept some bogus responses (--updatehack)
 %A  assume that a type (cgi,asp..) is always linked with a mime type (-%A php3=text/html) (--assume <param>)

Browser ID:
  F  user-agent field (-F "user-agent name") (--user-agent <param>)
 %F  footer string in Html code (-%F "Mirrored [from host %s [file %s [at %s]]]" (--footer <param>)
 %l  preferred language (-%l "fr, en, jp, *" (--language <param>)

Log, index, cache
  C  create/use a cache for updates and retries (C0 no cache,C1 cache is prioritary,* C2 test update before) (--cache[=N])
  k  store all files in cache (not useful if files on disk) (--store-all-in-cache)
 %n  do not re-download locally erased files (--do-not-recatch)
 %v  display on screen filenames downloaded (in realtime) (--display)
  Q  no log - quiet mode (--do-not-log)
  q  no questions - quiet mode (--quiet)
  z  log - extra infos (--extra-log)
  Z  log - debug (--debug-log)
  v  log on screen (--verbose)
  f *log in files (--file-log)
  f2 one single log file (--single-log)
  I *make an index (I0 don't make) (--index)
 %I  make an searchable index for this mirror (* %I0 don't make) (--search-index)

Expert options:
  pN priority mode: (* p3) (--priority[=N])
      0 just scan, don't save anything (for checking links)
      1 save only html files
      2 save only non html files
     *3 save all files
      7 get html files before, then treat other files
  S  stay on the same directory
  D *can only go down into subdirs
  U  can only go to upper directories
  B  can both go up&down into the directory structure
  a *stay on the same address
  d  stay on the same principal domain
  l  stay on the same TLD (eg: .com)
  e  go everywhere on the web
 %H  debug HTTP headers in logfile (--debug-headers)

Guru options: (do NOT use)
 #0  Filter test (-#0 '*.gif' 'www.bar.com/foo.gif')
 #f  Always flush log files
 #FN Maximum number of filters
 #h  Version info
 #K  Scan stdin (debug)
 #L  Maximum number of links (-#L1000000)
 #p  Display ugly progress information
 #P  Catch URL
 #R  Old FTP routines (debug)
 #T  Generate transfer ops. log every minutes
 #u  Wait time
 #Z  Generate transfer rate statistics every minutes
 #!  Execute a shell command (-#! "echo hello")

Command-line specific options:
  V execute system command after each files ($0 is the filename: -V "rm \$0") (--userdef-cmd <param>)
 %U run the engine with another id when called as root (-%U smith) (--user <param>)

Details: Option N
  N0 Site-structure (default)
  N1 HTML in web/, images/other files in web/images/
  N2 HTML in web/HTML, images/other in web/images
  N3 HTML in web/,  images/other in web/
  N4 HTML in web/, images/other in web/xxx, where xxx is the file extension
(all gif will be placed onto web/gif, for example)
  N5 Images/other in web/xxx and HTML in web/HTML
  N99 All files in web/, with random names (gadget !)
  N100 Site-structure, without www.domain.xxx/
  N101 Identical to N1 except that "web" is replaced by the site's name
  N102 Identical to N2 except that "web" is replaced by the site's name
  N103 Identical to N3 except that "web" is replaced by the site's name
  N104 Identical to N4 except that "web" is replaced by the site's name
  N105 Identical to N5 except that "web" is replaced by the site's name
  N199 Identical to N99 except that "web" is replaced by the site's name
  N1001 Identical to N1 except that there is no "web" directory
  N1002 Identical to N2 except that there is no "web" directory
  N1003 Identical to N3 except that there is no "web" directory (option set for g option)
  N1004 Identical to N4 except that there is no "web" directory
  N1005 Identical to N5 except that there is no "web" directory
  N1099 Identical to N99 except that there is no "web" directory
Details: User-defined option N
  %n Name of file without file type (ex: image) (--do-not-recatch)
  %N Name of file, including file type (ex: image.gif)
  %t File type (ex: gif)
  %p Path [without ending /] (ex: /someimages)
  %h Host name (ex: www.example.com) (--http-10)
  %M URL MD5 (128 bits, 32 ascii bytes)
  %Q query string MD5 (128 bits, 32 ascii bytes)
  %q small query string MD5 (16 bits, 4 ascii bytes) (--include-query-string)
     %s? Short name version (ex: %sN)
  %[param] param variable in query string

Shortcuts:
--mirror      <URLs> *make a mirror of site(s) (default)
--get         <URLs>  get the files indicated, do not seek other URLs (-qg)
--list   <text file>  add all URL located in this text file (-%L)
--mirrorlinks <URLs>  mirror all links in 1st level pages (-Y)
--testlinks   <URLs>  test links in pages (-r1p0C0I0t)
--spider      <URLs>  spider site(s), to test links: reports Errors & Warnings (-p0C0I0t)
--testsite    <URLs>  identical to --spider
--skeleton    <URLs>  make a mirror, but gets only html files (-p1)
--update              update a mirror, without confirmation (-iC2)
--continue            continue a mirror, without confirmation (-iC1)

--catchurl            create a temporary proxy to capture an URL or a form post URL
--clean               erase cache & log files

--http10              force http/1.0 requests (-%h)

example: httrack www.example.com/bob/
means:   mirror site www.example.com/bob/ and only this site

example: httrack www.example.com/bob/ other.example.com/mike/ +*.com/*.jpg
means:   mirror the two sites together (with shared links) and accept any .jpg files on .com sites

example: httrack www.example.com/bob/bobby.html +* -r6
means get all files starting from bobby.html, with 6 link-depth, and possibility of going everywhere on the web

example: httrack www.example.com/bob/bobby.html --spider -P proxy.example.com:8080
runs the spider on www.example.com/bob/bobby.html using a proxy

example: httrack --update
updates a mirror in the current folder

example: httrack --continue
continues a mirror in the current folder

HTTrack version 3.03BETAo4 (compiled Jul  1 2001)
Copyright (C) 1998-2013 Xavier Roche and other contributors
[compiled: Linux linux 2.2.18 #9 SMP Sat Dec 30 09:51:39 CET 2000 i586 unknown]

For many of you, the manual is now complete, but for the rest of us, I will now go through this listing one item at a time with examples... I will be here a while...


Syntax

httrack <URLs> [-option] [+<FILTERs>] [-<FILTERs>]

The syntax of httrack is quite simple. You specify the URLs you wish to start the process from (<URLS>), any options you might want to add ([-option], any filters specifying places you should ([+<FILTERs>]) and should not ([-<FILTERs>]) go, and end the command line by pressing <enter>. Httrack then goes off and does your bidding. For example:

httrack www.all.net/bob/

This will use the 'defaults' (those selections from the help page marked with '*' in the listing above) to image the web site. Specifically, the defauls are:

  w *mirror web sites
 %f *use proxy for ftp (f0 don't use)
  cN number of multiple connections (*c8)
  RN number of retries, in case of timeout or non-fatal errors (*R1)
 %P *extended parsing, attempt to parse all links, even in unknown tags or Javascript (%P0 don't use)
  NN  name conversion type (0 *original structure, 1+: see below)
  LN  long names (L1 *long names / L0 8-3 conversion)
  K   keep original links (e.g. http://www.adr/link) (K0 *relative link)
  o *save the server's error pages (404..) (o0 discard them)
  X *purge old files after update (X0 keep delete)
  bN  accept cookies in cookies.txt (0=do not accept,* 1=accept)
  u check document type if unknown (cgi,asp..) (u0 don't check, * u1 check but /, u2 check always)
  j *parse scripts (j0 don't parse)
  sN  follow robots.txt and meta robots tags (0=never,1=sometimes,* 2=always)
  C  create/use a cache for updates and retries (C0 no cache,C1 cache is prioritary,* C2 test update before)
  f *log file mode
  I *make an index (I0 don't make)
  pN priority mode: (* p3)  *3 save all files
  D  *can only go down into subdirs
  a  *stay on the same address
  --mirror      <URLs> *make a mirror of site(s) (default)

Here's what all of that means:

  w *mirror web sites

Automatically go though each URL you download and look for links to other URLs inside it, dowloading them as well.

 %f *use proxy for ftp (f0 don't use)

If there are and links to ftp URLs (URLs using the file transfer protocol (FTP) rather than the hypertext transfer protocol HTTP), go through an ftp proxy server to get them.

  cN number of multiple connections (*c8)

Use up to 8 simultaneous downloads so that at any gioven time, up to 8 URLs may be underway.

  RN number of retries, in case of timeout or non-fatal errors (*R1)

Retry once if anything goes wrong with a download.

 %P *extended parsing, attempt to parse all links, even in unknown tags or Javascript (%P0 don't use)

Try to parse all URLs - even if they are in Javascript, Java, tags of unknown types, or anywhere else the program can find things.

  NN  name conversion type (0 *original structure, 1+: see below)

Use the original directory and file structure of the web site in your mirror image of the site.

  LN  long names (L1 *long names / L0 8-3 conversion)

If filenames do not follow the old DOS conventions, store them with the same names used on the web site.

  K   keep original links (e.g. http://www.adr/link) (K0 *relative link)

Use relative rather than the original links so that URLs within this web site are adjusted to point to the files in the mirror.

  o *save the server's error pages (404..) (o0 discard them)

IF a page cannot be downloaded, the error page the server sent is saved in its place, so a broken link still lands on the site's own 'not found' page. This makes browsing go a lot smoother.

  X *purge old files after update (X0 keep delete)

Files not found on the web site that were previously there get deleted so that you have an accurate snapshot of the site as it is today - losing historical data.

  bN  accept cookies in cookies.txt (0=do not accept,* 1=accept)

Accept all cokkies sent to you and return them if requested. This is required for many sites to function. These cookies are only kept relative to the specific site, so you don't have to worry about your browser retaining them.

  u check document type if unknown (cgi,asp..) (u0 don't check, * u1 check but /, u2 check always)

This causes different document types to be analyzed differently.

  j *parse scripts (j0 don't parse)

This causes scripts to be parsed looking for URLs.

  sN  follow robots.txt and meta robots tags (0=never,1=sometimes,* 2=always)

This tells the program to follow the wishes of the site owner with respect to limiting where robots like this one search.

  C  create/use a cache for updates and retries (C0 no cache,C1 cache is prioritary,* C2 test update before)

If you are downloading a site you have a previous copy of, supplemental parameters are transmitted to the server, for example the 'If-Modified-Since:' field will be used to see if files are newer than the last copy you have. If they are newer, they will be downloaded, otherwise, they will not.

  f *log file mode

This retains a detailed log of any important events that took place.

  I *make an index (I0 don't make)

This makes a top-level index.html file so that if you image a set of sites, you can have one place to start reviewing the set of sites.

  pN priority mode: (* p3)  *3 save all files

This will cause all downloaded files to be saved.

  D  *can only go down into subdirs

This prevents the program from going to higher level directories than the initial subdirectory, but allows lower-level subdirectories of the starting directory to be investigated.

  a  *stay on the same address

This indicates that only the web site(s) where the search started are to be collected. Other sites they point to are not to be imaged.

  --mirror      <URLs> *make a mirror of site(s) (default)

This indicates that the program should try to make a copy of the site as well as it can.

Now that's a lot of options for the default - but of course there are a lot more options to go. For the most part, the rest of the options represent variations on these themes. For example, instead of saving all files, we might only want to save html files, or instead of 8 simultaneous sessions, we might want only 4.

If we wanted to make one of these changes, we would specify the option on the command line. For example:

httrack www.all.net/bob/ -c4 -B

This would restrict httrack to only use 4 siumultaneous sessions but allow it to go up the directory structure (for example to www.all.net/joe/) as well as down it (for example to www.all.net/bob/deeper/).

You can add a lot of options to a command line!


A Thorough Going Over

Now that you have an introduction, it's time for a more though coverage. This is where I go through each of the options and describe it in detail with examples... Actually, I won't quite do that. But I will get close.

Options tend to come in groups. Each group tends to be interrelated, so it's easier and more useful to go through them a group at a time with some baseline project in mind. In my case, the project is to collect all of the information on the Internet about some given subject. We will assume that, through a previous process, I have gotten a list of URLs of interest to me. Typically there will be hundreds of these URLs, and they will be a mixed bag of sites that are full of desired information, pages with lists of pointers to other sites, URLs of portions of a web site that are of interest (like Bob's home pages and subdirectories), and so forth. Let us say that for today we are looking for the definitive colleciton of Internet information on shoe sizes from around the world.


General Options

General options:
  O  path for mirror/logfiles+cache (-O path_mirror[,path_cache_and_logfiles])

For this project, I will want to keep all of the information I gather in one place, so I will specify that output area of the project as /tmp/shoesizes by adding '-O /tmp/shoesizes' to every command line I use.. for example:

httrack http://www.shoesizes.com -O /tmp/shoesizes

The action options tell httrack how to operate at the larger level.


Action Options

Action options:
  w *mirror web sites
  W  mirror web sites, semi-automatic (asks questions)
  g  just get files (saved in the current directory)
  i  continue an interrupted mirror using the cache
  Y   mirror ALL links located in the first level pages (mirror links)

If I want httrack to ask me questions - such as what options to use, what sites to mirror, etc. I can tell it to ask these questions as follows:

httrack http://www.shoesizes.com -O /tmp/shoesizes -W

I can also do:

httrack

OR

httrack -W

OR

httrack -w

The '-W' options asks whether the or not a site has to be mirrored, while the '-w' option does not ask this question but asks the remainder of the questions required to mirror the site.

The -g option allows you to get the files exactly as they are and store them in the current directory. This is handy for a relatively small collection of information where organization isn't important. With this option, the html files will not even be parsed to look for other URLs. This option is useful for getting isolated files (e.g., httrack -g www.mydrivers.com/drivers/windrv32.exe).

If I start a collection process and it fails for one reason or another - such as me interrupting it because I am running out of disk space - or a network outage - then I can restart the process by using the -i option:

httrack http://www.shoesizes.com -O /tmp/shoesizes -i

Finally, I can mirror all links in the first level pages of the URLs I specify. A good example of where to use whis would be in a case where I have a page that points to a lot of other sites and I want to get the initial information on those sites before mirroring them:

httrack http://www.shoesizes.com/othersites.html -O /tmp/shoesizes -Y

Proxy Options

Many users use a proxy for many of their functions. This is a key component in many firewalls, but it is also commonly used for anonymizing access and for exploiting higher speed communications at a remote server.

Proxy options:
  P  proxy use (-P proxy:port or -P user:pass@proxy:port)
 %f *use proxy for ftp (f0 don't use)

If you are using a standard proxy that doesn't require a user ID and password, you would do something like this:

httrack http://www.shoesizes.com -O /tmp/shoesizes -P proxy.www.all.net:8080

In this case, we have asusmed that proxy.www.all.net is the host that does the proxy service and that it uses port 8080 for this service. In some cases you will have to ask your network or firewall administrator for these details, however, in most cases they should be the same as the options used in your web browser.

In some cases, a user ID and password are required for the proxy server. This is common in corporate environments where only authorized users may access the Internet.

httrack http://www.shoesizes.com -O /tmp/shoesizes -P fc:password@proxy.www.all.net:8080

In this case, the user ID 'fc' and the password 'password' are used on proxy.www.all.net port 8080. Again, your network or firewall administrator can be most helpful in addressing the specifics for your environment.

FTP normally operates through a proxy server, but for systems that have direct connections to the Internet, the following option should help:

httrack ftp://ftp.shoesizes.com -O /tmp/shoesizes -%f0

Limits Options

Limits options:
  rN set the mirror depth to N
  mN maximum file length for a non-html file
  mN,N'                  for non html (N) and html (N')
  MN maximum overall size that can be uploaded/scanned
  EN maximum mirror time in seconds (60=1 minute, 3600=1 hour)
  AN maximum transfer rate in bytes/seconds (1000=1kb/s max)
  GN pause transfer if N bytes reached, and wait until lock file is deleted
  %eN set the external links depth to N (* %e0) (--ext-depth[=N])
  %cN maximum number of connections/seconds (*%c10)

Setting limits provides the means by which you can avoid running out of disk space, CPU time, and so forth. This may be particularly helpful for those who accidentally try to image the whole Internet.

httrack http://www.shoesizes.com -O /tmp/shoesizes -r50

In this example, we limit the directlry depth to 50 levels deep. As a general rule, web sites don't go much deeper than 20 levels or so, and if you think about it, if there are only 2 subdirectories per directory level, a directory structure 50 deep would have about 10 trillion directories. Of course many sites have a small number of files many levels deep in a directory structure for various reasons. In some cases, a symbolic link will cause an infinite recursion of directory levels as well, so placing a limit may be advisable.

httrack http://www.shoesizes.com -O /tmp/shoesizes -m50000000

This example sets the maximum file length for non-HTML files to 50 megabytes. This is not an unusual length for things like tar files, and in some cases - for example when there are images of CD-ROMs to fetch from sites, you might want a limit more like 750 megabytes.

httrack http://www.shoesizes.com -O /tmp/shoesizes -m50000000,100000

In this example, we have set a limit for html files as well - at 100,000 bytes. HTML files are rarely larger than this, however, in some cases larger sizes may be needed.

httrack http://www.shoesizes.com -O /tmp/shoesizes -M1000000000

This option sets the maximum total size - in bytes - that can be uploaded from a site - in this case to 1 gigabyte. Depending on how much disk space you have, such an option may be worthwhile.

httrack http://www.shoesizes.com -O /tmp/shoesizes -E3600

This sets the maximum runtime for the download process. Of course depending on the speed of your connection it may take longer or shorter runtimes to get the same job done, and network traffic is also a factor. 3600 seconds corresponds to one hour.

httrack http://www.shoesizes.com -O /tmp/shoesizes A100000000

This option specifies the largest number of bytes per second that should be used for transfers. For example, you might want to go slow for some servers that are heavily loaded in the middle of the day, or to download slowly so that the servers at the other end are less likely to identify you as mirroring their site. The setting above limits my bandwidth to 100 million bytes per second - slow I know, but I wouldn't want to stress the rest of the Internet.

httrack http://www.shoesizes.com -O /tmp/shoesizes -G100000000

In this case, the G option is used to 'pause' a download after the first gigabyte is downloaded pending manual removal of the lockfile. This is handy of you want to download some portion of the data, move it to secondary storage, and then continue - or if you want to only download overnight and want to stop before daylight and continue the next evening. You could even combine this option with a cron job to remove the lock file so that the job automatically restarts at 7PM every night and gets another gigabyte.

httrack http://www.shoesizes.com -O /tmp/shoesizes %e5

In this case, httrack will only go to depth 5 for external links, thus not imaging the entire web, but only yhose links within 5 links of these web pages.

Also note that the interaction of these options may cause unintended consequences. For example, limiting bandwidth and download time conspire to limit the total amount of data that can be downloaded.


Flow Control Options

Flow control:
  cN number of multiple connections (*c8)
  %cN maximum number of connections/seconds (*%c10)
  TN timeout, number of seconds after a non-responding link is shutdown
  RN number of retries, in case of timeout or non-fatal errors (*R1)
  JN traffic jam control, minimum transfert rate (bytes/seconds) tolerated for a link
  HN host is abandoned if: 0=never, 1=timeout, 2=slow, 3=timeout or slow

This example allows up to 128 simultaneous downloads.
Note that this is likely to crash remote web servers - or at least fail
to download many of the files - because of limits on the number of
simultaneous sessions at many sites.  At busy times of day, you might
want to lower this to 1 or 2, especially at sites that limit the number
of simultaneous users. Otherwise you will not get all of the downloads.

httrack http://www.shoesizes.com -O /tmp/shoesizes -c128


Many operating systems have a limit of 64 file
handles, including internet connections and all other files that can be
opened.  Therefore, in many cases, more that 48 connections might cause
a "socket error" because the OS can not handle that many sockets.  This
is also true for many servers.  As an example, a test with 48 sockets on
a cgi-based web server (Pentium 166,80Meg RAM) overloaded the machine
and stopped other services from running correctly.  Some servers will
ban users that try to brutally download the website.  8 sockets is
generally good, but when I'm getting large files (e.g., from a a site
with large graphical images) 1 or 2 sockets is a better selection.  Here
are some other figures from one sample set of runs:

Tests: on a 10/100Mbps network, 30MB website, 99 files (70 images (some are little, other are big (few MB)), 23 HTML) With 8 sockets: 1,24MB/s With 48 sockets: 1,30MB/s With 128 sockets: 0,93MB/s


This limits the number of connections per second.  It
is similar to the above option but allows the pace to be controlled
rather than the simultanaety.  It is particulsrly useful for long-term
pulls at low rates that allow little impact on remote infrastructure.
The default is 10 connections per second.

httrack http://www.shoesizes.com -O /tmp/shoesizes -%c20


The timeout option causes downloads to time out after
a non-response from a download attempt.  30 seconds is pretty reasonable
for many sites.  You might want to increase the number of retries as
well so that you try again and again after such timeouts.

httrack http://www.shoesizes.com -O /tmp/shoesizes -T30


This example increases the number of retries to 5.
This means that if a download fails 5 times, httrack will give up on it.
For relatively unreliable sites - or for busy times of day, this number
should be higher.

httrack http://www.shoesizes.com -O /tmp/shoesizes -R5


This is an interesting option.  It says that in a
traffic jam - where downloads are excessively slow - we might decide to
back off the download.  In this case, we have limited downloads to stop
bothering once we reach 10 bytes per second.

httrack http://www.shoesizes.com -O /tmp/shoesizes -J10


These three options will cause the download from a
host to be abandoned if (respectively) (0) never, (1) a timeout is
reached, (2) slow traffic is detected, (or) (3) a timeout is reached OR
slow traffic is detected.

httrack http://www.shoesizes.com -O /tmp/shoesizes -H0 httrack http://www.shoesizes.com -O /tmp/shoesizes -H1 httrack http://www.shoesizes.com -O /tmp/shoesizes -H2 httrack http://www.shoesizes.com -O /tmp/shoesizes -H3


Of course these options can be combined to provide a
powerful set of criteria for when to continue a download and when to
give it up, how hard to push other sites, and how much to stress
infrastructures.

---

### Link Following Options

Links options: %P *extended parsing, attempt to parse all links, even in unknown tags or Javascript (%P0 don't use) n get non-html files 'near' an html file (ex: an image located outside) t test all URLs (even forbidden ones) %L <file> add all URL located in this text file (one URL per line)


The links options allow you to control what links are
followed and what links are not as well as to provide long lists of
links to investigate.  Any setting other than the default for this
option forces the engine to use less reliable and more complex parsing.
'Dirty' parsing means that links like 'xsgfd syaze="foo.gif"' will cause
HTTrack to download foo.gif, even if HTTrack don't know what the "xsgfd
syaze=" tag actually means! This option is powerful because some links
might otherwise be missed, but it can cause errors in HTML or javascript.

This will direct the program to NOT search Javascript
for unknown tag fields (e.g., it will find things like
foo.location="bar.html"; but will not find things like bar="foo.gif";).
While I have never had a reason to use this, some users may decide that
they want to be more conservative in their searches.  As a note,
javascript imported files (.js) are not currently searched for URLs.

httrack http://www.shoesizes.com -O /tmp/shoesizes '%P0'


Now here is a classic bit of cleverness that 'does
the right thing' for some cases.  In this instance, we are asking
httrack to get images - like gif and jpeg files that are used by a web
page in its display, even though we would not normally get them.  For
example, if we were only getting a portion of a web site (e.g.,
everything under the 'bob directory') we might want to get graphics from
the rest of the web sote - or the rest of the web - that are used in
those pages as well so that our mirror will look right.

httrack http://www.shoesizes.com -O /tmp/shoesizes -n


Here, we limit the collection to bob's area of the
server - except that we get images and other such things that are used
by bob in his area of the server.

httrack http://www.shoesizes.com/bob/ -O /tmp/shoesizes -n


This option 'tests' all links - even those forbidden
(by the robot exclusion protocol) - by using the 'HEAD' protocol to test
for the presence of a file.

httrack http://www.shoesizes.com/ -O /tmp/shoesizes -t


In this case, we use a file to list the URLs we wish
to mirror.  This is particularly useful when we have a lot to do and
don't want to tirelessly type in URLs on command line after command line.
It's also useful - for example - if you update a set of mirrored sites
evey evening.  You can set up a command like this to run automatically
from your cron file.

httrack -%L linkfile -O /tmp/shoesizes


This will update the mirror of your list of sites
whenever it is run.

httrack -%L linkfile -O /tmp/shoesizes -B --update


The link file is also useful for things like this
example where, after a binary image of a hard disk was analyzed (image)
URLs found on that disk were collected by httrack:

strings image | grep “http://” > list; httrack -%L list -O /tmp/shoesizes


---

### Mirror Build Options

Build options: NN name conversion type (0 original structure, 1+: see below) N user defined structure (-N “%h%p/%n%q.%t”) LN long names (L1 long names / L0 8-3 conversion) K keep original links (e.g. http://www.adr/link) (K0 relative link) x replace external html links by error pages o save the server's error pages (404..) (o0 discard them) X purge old files after update (X0 keep delete) %x do not include any password for external password protected websites (%x0 include) (--no-passwords) %q include query string for local files (information only) (%q0 don't include) (--include-query-string)


The user can define naming conventions for building
the mirror of a site by using these options.  For example, to retain the
original structure, the default is used.  This only modifies the
structure to the extent that select characters (e.g., ~, :, <, >, \, and
@) are replaced by _ in all pathnames.

httrack http://www.shoesizes.com -O /tmp/shoesizes -N0


OR

httrack http://www.shoesizes.com -O /tmp/shoesizes


In either case, the mirror will build with the same
directory hierarchy and name structure as the original site.  For cases
when you want to define your own structure, you use a string like this:

httrack http://www.shoesizes.com/bob/ -O /tmp/shoesizes -N “%h%p/%n.%t”


In this case, %h, %p, $n, and %t stand for the href
element (e.g., http://www.shoesizes.com or ftp://ftp.shoesizes.com), %p
stands for the pathname (e.g., /bob/), %n stands for the name of the
file, and %t stands for type (file extension).  The full list of these
options follows:

%n Name of file without file type (ex: image) %N Name of file, including file type (ex: image.gif) %t File type (ex: gif) %p Path [without ending /] (ex: /someimages) %h Host name (ex: www.all.net) %M URL MD5 (128 bits, 32 ascii bytes) %Q query string MD5 (128 bits, 32 ascii bytes) %q small query string MD5 (16 bits, 4 ascii bytes) %s? Short name version (ex: %sN)


Other 'N' options include:

Details: Option N N0 Site-structure (default) N1 HTML in web/, images/other files in web/images/ N2 HTML in web/HTML, images/other in web/images N3 HTML in web/, images/other in web/ N4 HTML in web/, images/other in web/xxx, where xxx is the file extension (all gif will be placed onto web/gif, for example) N5 Images/other in web/xxx and HTML in web/HTML N99 All files in web/, with random names (gadget !) N100 Site-structure, without www.domain.xxx/ N101 Identical to N1 except that “web” is replaced by the site's name N102 Identical to N2 except that “web” is replaced by the site's name N103 Identical to N3 except that “web” is replaced by the site's name N104 Identical to N4 except that “web” is replaced by the site's name N105 Identical to N5 except that “web” is replaced by the site's name N199 Identical to N99 except that “web” is replaced by the site's name N1001 Identical to N1 except that there is no “web” directory N1002 Identical to N2 except that there is no “web” directory N1003 Identical to N3 except that there is no “web” directory (option set for g option) N1004 Identical to N4 except that there is no “web” directory N1005 Identical to N5 except that there is no “web” directory N1099 Identical to N99 except that there is no “web” directory


Long names are normally used (the -L0
option) but if you are imaging to a DOS file system or want
accessibility from older versions of DOS and Windows, you can use the
-L1 option to generate these filename sizes.

httrack http://www.shoesizes.com -O /tmp/shoesizes -L1


With the 'K' option, you can keep the original links
in files.  While this is less useful in being able to view a web site
froim the mirrored copy, it is vitally important if you want an accurate
copy of exactly what was on the web site in the first place.  In a
forensic image, for example, you might want to use this option to
prevent the program from modifying the data as it is collected.

httrack http://www.shoesizes.com -O /tmp/shoesizes -K


In this case, instead of leaving external links (URLs
that point to sites not being mirrored) in the pages, these links are
replaced by pages that leave messages indicating that they could not be
found.  This is useful for local mirrors not on the Internet or mirrors
that are on the Internet but that are not supposed to lead users to
external sites.  A really good use for this is that 'bugging' devices
placed in web pages to track who is using them and from where will be
deactivated byt his process.

httrack http://www.shoesizes.com -O /tmp/shoesizes -x


This option keeps the server's '404' error pages out
of the mirror, even though there were URLs pointing to the missing
files.  It is useful for saving space as well as eliminating
unnecessary files in operations where a working web site is not the
desired result.

httrack http://www.shoesizes.com -O /tmp/shoesizes -o0


This option prevents the authoatic purging of files
from the mirror site that were not found in the original web site after
an 'update' is done.  If you want to retain old data and old names for
files that were renamed, this option should be used.  If you want an
up-to-date reflection of the current web site, you should not use this option.

httrack http://www.shoesizes.com -O /tmp/shoesizes -X0


These options can be combined as desired to produce a
wide range of different arrangements, from collections of only graphical
files stored in a graphics area, to files identified by their MD5
checksums only, all stored in the same directory.

httrack http://www.shoesizes.com -O /tmp/shoesizes %x0 include


This will not include passwords for web sites.  If you
mirror http://smith_john:foobar@www.privatefoo.com/smith/, and exclude
using filters some links, these links will be by default rewritten with
password data.  For example, "bar.html" will be renamed into
http://smith_john:foobar@www.privatefoo.com/smith/bar.html This can be a
problem if you don't want to disclose the username/password! The %x
option tell the engine not to include username/password data in
rewritten URLs.

httrack http://www.shoesizes.com -O /tmp/shoesizes %q


This option is not very useful, because parameters are
useless, as pages are not dynamic anymore when mirrored.  But some
javascript code may use the query string, and it can give useful
information.  For example: catalog4FB8.html?page=computer-science is
clearer than catalog4FB8.html Therefore, this option is activated by
default.

---

### Spider Options

These options provide for automation with regard to
the remote server.  For example, some sites require that cookies be
accepted and sent back in order to allow access.

Spider options: bN accept cookies in cookies.txt (0=do not accept, 1=accept) u check document type if unknown (cgi,asp..) (u0 don't check, * u1 check but /, u2 check always) j parse scripts (j0 don't parse) sN follow robots.txt and meta robots tags (0=never,1=sometimes,* 2=always) %h force HTTP/1.0 requests (reduce update features, only for old servers or proxies) %B tolerant requests (accept bogus responses on some servers, but not standard!) %s update hacks: various hacks to limit re-transfers when updating %A assume that a type (cgi,asp..) is always linked with a mime type (-%A php3=text/html) (--assume <param>)


By default, cookies are universally accepted and
returned.  This makes for more effective collection of data, but allows
the site to be identified with its collection of data more easily. To
disable cookies, use this option:

httrack http://www.shoesizes.com -O /tmp/shoesizes -b0


Some documents have known extension types (e.g.,
html), while others have unknown types (e.g., iuh87Zs) and others may
have misleading types (e.g., an html file with a 'gif' file extension.
These options provide for (0) not checking file types, (1) checking all
file types except directories, and (2) checking all file types including
directories. Choose from these options:

httrack http://www.shoesizes.com -O /tmp/shoesizes -u0 httrack http://www.shoesizes.com -O /tmp/shoesizes -u1 httrack http://www.shoesizes.com -O /tmp/shoesizes -u2 ```

Meta tags or 'robots.txt' files on a web site are used to indicate what files should and should not be visited by automatic programs when collectiong data. The polite and prudent move for normal data collection

(本文超出站点单文档体积上限,已截断)