Mika H.
Mika H.

Reputation: 4339

wget with many pages

The -k option in wget converts the links to local or remote, according to whether the file that is linked to is also downloaded. (See here for more details)

Is it possible to use wget in this way: I download two webpages, say www.example.com/1 and www.example.com/2, where the first page has a link to the second page, and wget converts the link to local, since the second page is also downloaded.

NOTE: I can't download www.example.com/1 using a recursive option with depth 1, since www.example.com/1 may have links to other pages, and I only want www.example.com/2.

Upvotes: 1

Views: 495

Answers (1)

Luke
Luke

Reputation: 14138

This should do the trick:

wget -kp www.example.com/1 www.example.com/2

From the site you linked:

‘-p’ ‘--page-requisites’ This option causes Wget to download all the files that are necessary to properly display a given html page. This includes such things as inlined images, sounds, and referenced stylesheets.

Upvotes: 1

Related Questions