thalastplaya
Posts: 20
Joined: Tue Oct 16, 2012 8:21 am

corrupted picture from google (wget)

Sat Nov 15, 2014 7:56 pm

Hello, I am fairly new to wget, but I am trying to write my own script. The script should get the first picture from google image based on a searh term.

I use the following:

Code: Select all

wget -U chrome -O test.jpg http://images.google.com/images?q=hotdog\&as_filetype=jpg
It does download a file, but not an image. It appears to be the html file?

Can any one help?

This is the log from one of my tries:

Code: Select all

--2014-11-15 20:14:12--  http://images.google.com/images?q=hotdog&as_filetype=jpg
Resolving images.google.com (images.google.com)... 212.10.212.121, 212.10.212.123, 212.10.212.79, ...
Connecting to images.google.com (images.google.com)|212.10.212.121|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://images.google.com/images?q=hotdog&tbm=isch&tbs=ift:jpg [following]
--2014-11-15 20:14:13--  http://images.google.com/images?q=hotdog&tbm=isch&tbs=ift:jpg
Reusing existing connection to images.google.com:80.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘test.jpg’


    [  <=>                                                                        ] 38,782       112KB/s   in 0.3s   


2014-11-15 20:14:13 (112 KB/s) - ‘test.jpg’ saved [38782]

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: corrupted picture from google (wget)

Sat Nov 15, 2014 10:27 pm

I suggest it is probably your search url that is wrong - if I plug that url straight into a browser I get a Google image search page back with a number of images, not a single .jpg which is what you seem to be expecting. That would explain you getting html as the source of the page.

thalastplaya
Posts: 20
Joined: Tue Oct 16, 2012 8:21 am

Re: corrupted picture from google (wget)

Sun Nov 16, 2014 10:39 am

You're right.. Do you have any idea how you get the first picture?

Return to “Troubleshooting”