weixin_33736832 2011-12-27 23:03 采纳率: 0%
浏览 69

Google Local Search API + Python

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条回答 默认 最新

  • derek5. 2011-12-27 23:13
    关注

    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

    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器