Best way to download an antire site with ruby

What is the best way to download all Web S. resources (html, images,
…) to a local directory using Ruby?
Thanks,
A.

med addame wrote:

What is the best way to download all Web S. resources (html, images,
…) to a local directory using Ruby?
Thanks,
A.

I’d say Hpricot + Net::HTTP

something like…

class Page
attr_accessor :html
attr_accessor :links

def open
#… do net http open here
end

def save
# save html as .html
# save images …
# for each link that are from anchor tags
# - create a new page
# - call open/parse/save
end

def parse_links
#… use hpricot here to parse links
#… add them to an @links array
#… give them each a type (img,anchor,etc)
end
end

med addame wrote:

What is the best way to download all Web S. resources (html, images,
…) to a local directory using Ruby?

Quickest and easiest:

system(“wget -p -np -r Lua 5.1 Reference Manual - contents”)

Also useful are the -I, -P, -nH options.