Search engine

Question by zuser00:
How do you write a script to save a complete website? Python, C++, or Ruby?

How do you write a script in (python, c++, or ruby) that saves a complete website? By complete website I mean the html file and the folder that holds all the images, javascript, and css files of the website. Normally this can be done by just Ctrl+S on any browser, but how do you write that into a script?


——————————————

Answer by Michael
Have you considered using a programme such as httrack? – http://www.httrack.com/

There is code available to incorporate httrack into python – http://www.satzbau-gmbh.de/staff/abel/httrack-py/

However a single command can be used to save a complete website without resorting to any scripting (python or otherwise). The httrack documentation includes the following example:

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

In this example, we ask httrack to begin 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).

——————————————
Add your own answer in the comments!