Mirror a site with wget and download static media

wget

I'd like to mirror a site with wget and convert all the links to the local copies I've downloaded. So far that's easy all I have to do is wget -mk http://site.com

However all of the static media is located in a different domain, if I follow all of the foreign hosts using the -H option it will download that static media files, but it will also download anything else externally linked.

Is there a way to specify 'only download foreign hosts specified in list X'?

Best Answer

See the section in the wget manpage after the --page-requisites option, it has an example:

Links from that page to external documents will not be followed. Actually, to download a single page and all its requisites (even if they exist on separate websites), and make sure the lot displays properly locally, this author likes to use a few options in addition to -p:

wget -E -H -k -K -p http://<site>/<document>