Crawling a website with wget

Here’s an example that I’ve used to get all the text from Paul Graham’s website:

$ wget --mirror --wait=15 --random-wait --adjust-extension --domains=paulgraham.com --user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" https://paulgraham.com/
Enter fullscreen mode

The --mirror parameter is short for -r -N -l inf --no-remove-listing:

ParameterDescription
-r, --recursiveEnables recursive downloading (following links)
-N, --timestampingOnly downloads newer files than local copies
-l inf, --level=infSets the recursion level to infinite
--no-remove-listingKeep “.listing” files that are created to keep track of directory listings

The rest of the used parameters:

ParameterDescription
--adjust-extensionMake sure that “.html” is added to the files
--domainsComma-separated list of domains to be followed
--user-agentSends the given “User-Agent” header to the server

Other useful parameters:

ParameterDescription
--page-requisitesDownloads things as inlined images, sounds, and referenced stylesheets
--span-hostsAllows downloading files from links that point to different hosts
--convert-linksConverts links to local links (allowing local viewing)
--no-check-certificateBypasses SSL certificate verification.
--directory-prefix=/my/directorySets up the destination directory.
-e robots=offIgnores robots.txt instructions.

Discover more from Coursity

Subscribe to get the latest posts sent to your email.

Leave a Comment

Your email address will not be published. Required fields are marked *

Discover more from Coursity

Subscribe now to keep reading and get access to the full archive.

Continue reading

Scroll to Top
Selecting a domain name and web hosting provider is the first step to creating your dropshipping website.