Shivam Singhal
Shivam Singhal

Reputation: 41

How to download static website with WGET including its CSS, JS, Images in separate folders

The website loads its assets from some other domain & I am not able to download those assets at all.(JS, CSS, Images, etc)

Say the website is example.com & it includes assets from, say, assets.orange.com.

How do I tell WGET to download those assets, save it into different folders(js, css, images) and convert the links in the downloaded HTML files?

I don't know what I am doing wrong & where to specify assets.orange.com in this command.

wget \
         --mirror \
       --recursive \
     --no-clobber \
     --page-requisites \
     --html-extension \
     --convert-links \
     --restrict-file-names=windows \
     --domains example.com \
     --no-parent \
         example.com

Upvotes: 2

Views: 2080

Answers (1)

Daweo
Daweo

Reputation: 36360

where to specify assets.orange.com in this command

wget manual says that --domains usage is

-D domain-list
--domains=domain-list

where domain-list is a comma-separated list of domains, so if you wish to specify more than one you should do

--domains=example.com,assets.orange.com

According to wget manual if you aim to to download all the files that are necessary to properly display a given HTML page you might use

-p
--page-requisites

Beware that This includes such things as inlined images, sounds, and referenced stylesheets.

Upvotes: 1

Related Questions