Does anyone know how to do this?
Does anyone know how to do this?
This question came from our site for professional and enthusiast programmers.
wget -erobots=off --no-parent --wait=3 --limit-rate=20K -r -p -U "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)" -A htm,html,css,js,json,gif,jpeg,jpg,bmp http://example.com
This runs in the console.
this will grab a site, wait 3 seconds between requests, limit how fast it downloads so it doesn't kill the site, and mask itself in a way that makes it appear to just be a browser so the site doesn't cut you off using an anti-leech mechanism.
-A parameter that indicates a list of the file types you want to download.
You can also use another tag,
-D domain1.com,domain2.com to indicate a series of domains you want to download if they have another server or whatever for hosting different kinds of files. There's no safe way to automate that for all cases, if you don't get the files.
wget is commonly preinstalled on Linux, but can be trivially compiled for other Unix systems or downloaded easily for Windows: GNUwin32 WGET
Use this for good and not evil.
Good, Free Solution: HTTrack
HTTrack is a free (GPL, libre/free software) and easy-to-use offline browser utility.
It allows you to download a World Wide Web site from the Internet to a local directory, building recursively all directories, getting HTML, images, and other files from the server to your computer. HTTrack arranges the original site's relative link-structure. Simply open a page of the "mirrored" website in your browser, and you can browse the site from link to link, as if you were viewing it online. HTTrack can also update an existing mirrored site, and resume interrupted downloads. HTTrack is fully configurable, and has an integrated help system.
On Linux systems, 'wget' does this, pretty much.
Its also been ported to several other platforms, as several of the other answers mention.
Look at the Scrapbook extension for firefox. It does an amazing job at this and also integrate with firebug and allows you to delete elements out of the DOM before you save if you'd like.
You need to use wget - which is available for most platforms. curl will not request documents recursively, which is one of wget's major strengths.
Linux: (usually included in the distro) http://www.gnu.org/software/wget/
PLEASE make sure you aren't hammering the website - set up suitable delays between requests, and make sure it's within the site's terms of service.
Actually, following up my comment in GWLlosa's post, I just remembered I have GnuWin32 installed, and sure enough it contains a Windows port of wget.
GnuWin32 provides Win32-versions of GNU tools, or tools with a similar open source licence. The ports are native ports, that is they rely only on libraries provided with any 32-bits MS-Windows operating system, such as MS-Windows 95 / 98 / 2000 / NT / XP
I used this some years ago and it worked well. Windows only. Used to be adware but no longer, apparently:
wget --random-wait -r -p -e robots=off -U "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)" --limit-rate=20k -b http://www.example.com
-p: parameter tells wget to include all files, including images.
-e robots=off: ignore sites robots.txt rules
-U "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)": user agent string
--random-wait: avoid getting blacklisted
--limit-rate=20k: limits the rate at which it downloads files.
-b: continues wget after logging out.
I think IDM site grabber is the best solution, there is also Teleport pro
Free Download Manager can download complete web-sites as well.
Windows only I think.