6

I downloaded a website using:

wget -c --mirror -p http://www.somewebsite.com

for offline viewing and I just remembered that I forgot the --convert-links option! They are all on my hard drive right now. Is there a way to do --convert-links without redownloading the whole website?

0

2 Answers 2

10

Straightforward one: serve local directory with something like SimpleHTTPServer, then re-wget from localhost with appropriate options.

5
  • 1
    Quite a good idea, why the down vote?
    – phunehehe
    Feb 14, 2011 at 9:32
  • 3
    I should add that one shout edit /etc/hosts to fake localhost as the website being mirrored. And this will only work well if the links all point to the same webpage (i.e no hot-linked images).
    – phunehehe
    Feb 14, 2011 at 9:34
  • What is SimpleHTTPServer? Is it the Python module? If so, can you show how to use it (so I can revoke my careless downvote).
    – tshepang
    Feb 14, 2011 at 13:01
  • 1
    @Tshepang Yes Python is pretty awesome with the huge load of modules :) SimpleHTTPServer is my favorite
    – phunehehe
    Feb 14, 2011 at 15:10
  • @phunehehe That's very clever. If the local files link to remote files, I don't think the answer would work without your idea. As long as you have downloaded the remote files locally, your idea will work as expected. Mar 24 at 22:52
3

Also, don't forget to use the option --timestamping, or add timestamping=on to "~/.wgetrc". It ensures that when you re-mirror the website, you don't re-download the whole website, but only changed/new files. See the section Time-Stamping in manpage of wget for more.

FWIW I use this to mirror my blog:

wget --mirror --adjust-extension --convert-links --no-cookies --timestamping http://example.com --output-file=log-blog

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.