3

I'm trying to download all the images of a website

here is the website :

https://wall.alphacoders.com/by_sub_category.php?id=173173&name=Naruto+Wallpapers

I tried:

wget -nd -r -P /home/Pictures/ -A jpeg,jpg,bmp,gif,png https://wall.alphacoders.com/by_sub_category.php?id=173173&name=Naruto+Wallpapers
s

But it doesn't download the images

result

HTTP request sent, awaiting response... 200 OK Length: unspecified [text/html] /home/Pictures: Permission denied/home/Pictures/by_sub_category.php?id=173173: No such file or directory

Cannot write to ‘/home/Pictures/by_sub_category.php?id=173173’ (No such file or directory).

  • 1
    Your link in the command is just one picture. – TheWanderer Nov 2 '16 at 19:35
  • @dragon, could you provide output of your command? – numand Nov 2 '16 at 19:44
  • @numand it downloads some files like this "index.html?lang=Dutch" and robots.txt – dragon Nov 2 '16 at 20:04
  • @Zacharee1 see the edit but it doesn't download any picture – dragon Nov 2 '16 at 20:41
1

To download all images from the specified page with wget you can use this command:

wget -i `wget -qO- https://wall.alphacoders.com/by_sub_category.php\?id\=173173\&name\=Naruto+Wallpapers | sed -n '/<img/s/.*src="\([^"]*\)".*/\1/p'`

In this example HTML file is download with wget to STDOUT, parsed with sed so that only img URL remain and passed to wget -i as an input list for downloading.

Note that it will download only the images on this page, but they are just thumbnails (350px wide).

If you'd like to download full images, you should go a step forward and change the parsed IMG urls so that they correspond the hi-res images. You can do it with sed or awk:

wget -i `wget -qO- https://wall.alphacoders.com/by_sub_category.php\?id\=173173\&name\=Naruto+Wallpapers | sed -n '/<img/s/.*src="\([^"]*\)".*/\1/p' | awk '{gsub("thumb-350-", "");print}'`

The result of running the last command is a pack of HD wallpapers on your disk

enter image description here

  • Thanks :) but how to specify path to download the images in it ? -P /home/Pictures/ ?? – dragon Nov 9 '16 at 14:49

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.