0

I am trying to crate a program (in python) that will output query Google’s Local Search and print results to the console. I want to be able to search for “café in London” and get the company names addresses and phone number printed on screen. I found an easy-to-use Python wrapper for the Google Maps and Local Search APIs on available at:

http://py-googlemaps.sourceforge.net/#googlemaps-methods

The wrapper essentialy returns data in JSON format but it only seems to return 32 results out of the available thousands. My question is how do I access more?

The code does something like this:

url = query_url + encoded_params
request = urllib2.Request(url, headers=headers)
response = urllib2.urlopen(request)
return (url, json.load(response))

That results in urls:

/local?q=cafe+near+London&start=0&rsz=large&v=1.0
/local?q=cafe+near+London&start=8&rsz=large&v=1.0
/local?q=cafe+near+London&start=16&rsz=large&v=1.0
/local?q=cafe+near+London&start=24&rsz=large&v=1.0        

..and JSON formated data The difference in the urls is the 'start=' value that increments by 8. However when substituting start= 32 I get an error. The maximum number of results seems locked at 32 in total. How do I go beyond that?

Thanks in advance for all your help

2 Answers 2

1

Google allows only 32 on 4 pages. The URLs you get are for pagination. Check this link

http://code.google.com/apis/maps/documentation/localsearch/devguide.html

and search "There is no way to get more than" on that page using ctrl-F

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for your prompt answer. Quite disappointing though that you only get 32 results and that’s it! No wonder I have been trying and trying to no avail. Anyway, thanks again. :)
0

Are you sure your use of the Google API complies with the TOS? Im no lawyer but I recall that saving or re-using the results was not allowed.

Having said that, there is another approach. you could just screen scrape the results. not that I would of course recommend such an Illegal activity. That way you could go over the results using the url like this:

http://www.local.google.com/?q=café+in+London&start=0
http://www.local.google.com/?q=café+in+London&start=10
http://www.local.google.com/?q=café+in+London&start=20
http://www.local.google.com/?q=café+in+London&start=30

etc.

In any case the results number is limited to 160 this way.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.