PDA

View Full Version : Download images from internet



Fertech
August 2nd, 2014, 02:44 AM
I want to google images but I don't want to download one by one, how can I
Download a google website full of images in one shot?

sudodus
August 2nd, 2014, 06:34 AM
1. What images do you want, pictures or iso images or some other kind of image files?

2. It depends on the web-site what is possible to do. If you can connect via wget, it is easy to download several images in one shot.


man wget

Fertech
August 3rd, 2014, 12:46 AM
.jpg and .png

sudodus
August 3rd, 2014, 09:10 AM
If the owners of the website wants people to download many files, they might make it easy by setting up anonymous ftp, so that you can connect via ftp and use
mget * or some GUI tool to get all files in a particular directory.

You can try with wget, but the owners of the website might not want massive downloading, so they might have made it hard to connect via wget. See the next post by ofnuts. Anyway, it might work, so try it.

As an example, you can try the following command, which should download a png file illustrating a tool to make USB boot drives by cloning iso files and compressed image files.


wget 'https://help.ubuntu.com/community/mkusb/pictures?action=AttachFile&do=get&target=13-toggle-USB-only_show-all-drives.png'

works but gives you an ugly file name. This command creates a nicer file name


wget -O 13-toggle-USB-only_show-all-drives.png 'https://help.ubuntu.com/community/mkusb/pictures?action=AttachFile&do=get&target=13-toggle-USB-only_show-all-drives.png'

It is hard to get several files with one command, when the files are stored like that, because you must create a list and then use that list.

Another example shows that it can be easier, when the files are there like at the web page http://phillw.net/isos/linux-tools/mkusb/

Cut and paste the list of content to an editor, remove everything except the file names, and you get


md5sum.txt.asc
mkUSB-quick-start-manual-74.pdf
mkUSB-quick-start-manual.pdf
mkusb
mkusb-old
mkusb-old-plus-minor-fix
mkusb74

which you save as the file 'list'. Then this command will download all those files


while read i;do wget "http://phillw.net/isos/linux-tools/mkusb/$i";done<list

ofnuts
August 3rd, 2014, 09:39 AM
They cannot disable wget. What they can try to do is:

check the "user agent" string, but wget allows you specify the user agent, so you can spoof a regular browser
prevent "hot linking" (ie, serve images only if they are referred to by one page on the site) but wget also lets you specify a forged "referer" (sic) URL


What you cannot bypass (unless you have a botnet :)) is the server limiting traffic per IP address (and banning your address in case of abuse)

If the images are stored with consecutive numbers, you can take advantage the brace expansion in bash:


wget http://some.site.on.the.net/images/image{000..100}.png

sudodus
August 3rd, 2014, 10:27 AM
Thanks ofnuts, I'll edit my post accordingly :-)