2

I used this command to download a webpage recursively in 5 levels to navigate it offline:

wget -r -p --convert-links http://www.pythondiario.com

But the images are not downloaded properly.

How do I fix this?

  • 1
    This doesn't work because the images on the site you mention are hosted on a different site. – Satō Katsura Aug 26 '17 at 16:32
  • Ok, so how can I fix this? – Ekapunk Aug 26 '17 at 17:09
  • You use some other tool to mirror the site. – Satō Katsura Aug 26 '17 at 17:32
  • Thanks to your explanation of my problem, I found a way to solve my problem using wget. If anyone has the same problem, here is the solution: Use the "-H" command to allow the download of files from different domains – Ekapunk Aug 26 '17 at 18:05
3

As Satō Katsura noted in a comment, some images on this page are on a different host. By default, wget does not follow cross-host links (this applies to image retrieval as well as recursive traversal).

To make wget follow cross-host links, pass the -H option. It is recommended to pass the -D option as well to limit which hosts are traversed, otherwise you risk downloading a lot of linked content.

wget -r -p --convert-links -H -Dblogspot.com http://www.pythondiario.com

Note that -H and -D apply to recursive traversal as well as images. You can further restrict cross-host links by adding -R or --reject-regex options.

See “spanning hosts” in the manual for more details.

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.