Make wget download page resources on a different domain

wget --recursive --level=inf --page-requisites --convert-links --html-extension \
     --span-hosts=domainA,domainB url-on-domainA

UPDATE: I remember the command above worked for me in the past (that was 2010 and I was using GNU Tools for Windows back then); however I had to change it to the following when I wanted to use it today:

wget --recursive --level=inf --page-requisites --convert-links \
     --adjust-extension --span-hosts --domains=domainA,domainB domainA

The shorthand for that would be: wget -rEDpkH -l inf domainA,domainB domainA

  • -r = --recursive
  • -l <depth> = --level=<depth>
  • -E = --adjust-extension
  • -p = --page-requisites
  • -K = --backup-converted
  • -k = --convert-links
  • -D <domain-list> = --domains=<domain-list>
  • -H = --span-hosts
  • -np = --no-parent
  • -U <agent-string> = --user-agent=<agent-string>

GNU Wget Manual: https://gnu.org/software/wget/manual/wget.html