google image search shell api

I'm looking for something like API for google-image search using in bash shell.

I want to gel list of links and resolution-info for some query string.

The ideal will be curling or wgeting any page and than parsing results.

But I cannot find any parseble page variant.

I'm trying $> curl "http://images.google.com/images?q=apple" and get nothing.

Any ideas?

Upvotes: 1

Views: 1421

Answers (2)

fstab
fstab

Reputation: 5029

It seems that Google Images does not like curl (403 error code). To avoid the 403 error, you need to fake the user agent, like this:

wget -qO- "http://images.google.com/images?q=apple" -U "Firefox on Ubuntu Gutsy: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.14) Gecko/20080418 Ubuntu/7.10 (gutsy) Firefox/2.0.0.14"

Still, I guess this is not enough since you get a load of javascript code, that needs to be executed somehow.

My 2 cents.

Upvotes: 0

Alex K.
Alex K.

Reputation: 175748

There are APIs for Google's searches; http://code.google.com/apis/imagesearch although I don't know how you would meed the referrer/branding licensing requirements.

Upvotes: 1

Related Questions