Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want a command that I type a URL, for example, and it download all photos on this site in a folder, but not only images of the site's homepage. This command need to download the images from all parts of the site, such as /

Please show me an example using this url: and test it before answer the question

share|improve this question

You can use:

wget -r -A=.jpg,.png

With this command you will get all the JPG and PNG files, but you can get banned from the site.

So, if you use:

wget --random-wait --limit-rate=100k -r -A=.jpg,.png

You'll get your images waiting a random time between downloads and setting a speed limit.

share|improve this answer
your command is not working – Zignd Jun 8 '12 at 14:06
please check out the post again, i edited it – Zignd Jun 8 '12 at 14:12
Maybe you've been banned anyway. – Vic Abreu Jun 8 '12 at 14:17
tumblr is the kind of site that would very likely ban these scraping scripts. – heltonbiker Jun 8 '12 at 14:18

You can download the entire website (I would use wget -r -p -l inf -np), then (or simultaneously) run a shell script to delete all non-image files (the file command can be used to check if a file is an image).

(The -A/-R options of wget are not reliable; they only check the extension of the URL (so you can filter by .jpg, .jpeg, .png, etc.), but there is no requirement for these to be present.)

share|improve this answer

You hardly could get good results by using the brute force approach most one-liner commands would give (although I use the wget option to get the whole site a lot).

I would suggest you to create a script that uses some form of condidional selection and loops to actually match and follow the kind of links that take you to the images you want.

The strategy I usually follow:

  • In the browser, go to the first page of interest and show the source code;
  • Right click an image -> "Image properties" -> locate the 'src=' attributes and the image tags.
  • Get the overall pattern of these tags/links/hrefs, and use some regex (grep -o) to parse the links;
  • Use these links with some command to download the images;
  • Get also the links on the page that take to other pages;
  • Repeat.

This is indeed much more complicated than a one-liner that takes it all, but the experience is enlightening. Webscraping is an art on itself.

For that, also, I would recommend Python, although it is perfectly possible to do it with Shell Script (bash) if you prefer, or any scripting language by the way (Ruby, PHP, perl, etc.).

Hope this helps.

share|improve this answer

You can use a git repo such as this one:

There are also other repos which provide similar functionality.

share|improve this answer
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review – techraf Jun 13 at 21:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .