Google Image Search AJAX API, filter by exact size, can it be done with Python or JavaScript?

242 views
Skip to first unread message

Gautama Dude

unread,
Sep 6, 2010, 6:28:00 PM9/6/10
to Google AJAX APIs
I want to search with the "exact size" filter on, I can do it on the
google image search page but can't seam to figure out how to do it
with the AJAX API, if it's possible at all.

So my question is, if possible, how do I do it?

I prefer to use Python, but JavaScript might be acceptable.

Part of the code I'm working with looks like this:

query = urllib.urlencode({'q': query})
urls = []
urls.append('http://ajax.googleapis.com/ajax/services/search/
images?v=1.0&%s' % query)
urls.append('http://ajax.googleapis.com/ajax/services/search/
images?v=1.0&start=4&%s' % query)
urls.append('http://ajax.googleapis.com/ajax/services/search/
images?v=1.0&start=8&%s' % query)

search_responses = []
for url in urls:
try:
u = urllib2.urlopen(url)
search_responses.append(u)
...

I tried adding "&tbs=isch:1,isz:ex,iszw:11,iszh:11" to the url (width:
11, height:11) but it didn't change anything.

Jeremy Geerdes

unread,
Sep 6, 2010, 6:36:28 PM9/6/10
to google-ajax...@googlegroups.com
Although you can filter by general size (e.g., medium, large, extra large, etc.), there is no documented way to restrict the ImageSearch portion of the Search API to specific dimensions.

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
http://jgeerdes.home.mchsi.com
jrge...@gmail.com

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

> --
> You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group.
> To post to this group, send email to google-ajax...@googlegroups.com.
> To unsubscribe from this group, send email to google-ajax-searc...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-ajax-search-api?hl=en.
>

Reply all
Reply to author
Forward
0 new messages