I want to download the images shown in a web page, for example https://www.wikiart.org/en/paintings-by-style/art-nouveau-modern, (the ones under the All Artworks tab), and store them in a folder (e.g. /home/boomer/GH/A_nou/).

How can I achieve this?

I can use wget or curl for that, but sadly I have no idea of what to do with them.

Also I don't want the intermediate images, (banners, logos, etc.), only full size images for everything under the artwork section.

  • unfortunately, wget return only one image from the needed list of images, this one <img alt="Artworks by style: Art Nouveau (Modern)" itemprop="image" src="https://uploads5.wikiart.org/images/gustav-klimt/hygeia-detail-of-medicine-1907.jpg!PinterestLarge.jpg" title="Artworks by style: Art Nouveau (Modern)"/> – RomanPerekhrest Oct 28 '17 at 21:14

Look in the source, search for .jpg" and you will see all the images there, notice they are surrounded by double quotes. So save the HTML source to your computer, I chose /tmp/test_art.html and I search for ", replace with newline, then grep all lines ending with jpg, then pass all those lines to wget:

wget $(sed 's/"/\n/g;' /tmp/test_art.html| grep 'jpg$')

This is really trivial, of course, some sed guru will come along shortly and come up with a one liner, saving the grep ... I think it is too much work for ad hoc stuff like this ... quick and dirty.

You open a terminal and change directory to the directory where you want to store the files:

cd /home/boomer/GH/A_nou/

Then you run the above command.

  • pastebin.com/0jarFnhB I got this done, but only 60 of the images are there, why is this so? – kwonli Oct 28 '17 at 16:57
  • I guess this comes from the first entry, which contains a !, evil, that! Before saving the file, you must click "Load More" ... you really want to download 6000 images ? If you want the program to do this, you must use something that can handle JavaScript, such as node.js ... that is not trivial ... – thecarpy Oct 28 '17 at 21:07

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.