从 Google Places API 获得超过 5 条评论
Posted
技术标签:
【中文标题】从 Google Places API 获得超过 5 条评论【英文标题】:To get more than 5 reviews from google places API 【发布时间】:2017-01-06 12:22:55 【问题描述】:我正在做一个应用程序,我使用 google places API 提取 google 评论。当我在“https://developers.google.com/maps/documentation/javascript/places”中阅读与之相关的文档时,我发现我只能获得 5 条热门评论。有什么选择吗以获得更多评论。
【问题讨论】:
Google places API returning only 5 results的可能重复 【参考方案1】:要使用 Google API 访问超过 5 条评论,您必须从 Google 购买高级数据访问权限。 该高级计划将授予您访问各种额外数据点的权限,而您必须花一大笔钱。
如果您是想要检索所有评论的企业主,您可以这样做,但首先您必须通过 MyBusiness API 进行验证,更多信息请点击此处:https://developers.google.com/my-business/
【讨论】:
这是正确的,如果您是使用 Google My Business API 的企业主,您可以检索所有评论。 developers.google.com/my-business/content/… 作为企业主,我们可以通过 MyBusiness API developers.google.com/my-business 获得所有评论。作为应用程序(第三方),我们可以通过地点 api 获得评论。 maps.googleapis.com/maps/api/place/details/… 限制为 5。因此,带有位置 api 的高级计划我们能够获得有关其位置的所有评论。正确的? @tekill @Nidhin 你能选择答案吗,因为已经回答了。谢谢你,我希望你能够完成你打算做的事情。 看起来他们停止支持新客户了。 “注意:Google Maps Platform 高级计划不再适用于注册客户或新客户。”有什么选择吗?【参考方案2】:有一个功能请求:Issue 7630: Response to Include More Than 5 Reviews ─ 我建议您“加星”以接收更新。
【讨论】:
【参考方案3】:不幸的是,除非您在按照 Tekill 所说的经过验证后成为企业主,否则无法在场所 API 中获得超过 5 条评论。 但看起来有一些外部服务可以获得所有评论。我的猜测是他们直接从谷歌地图上抓取它们: 其中一些服务是Wextractor、ReviewShake 和AllReviews
【讨论】:
这些没有帮助。而且也不返回所有评论。【参考方案4】:除了@miguev 的回答之外,如果不使用高级 API(据我与之交谈过的一位 Google 地图人员所说),目前无法获得超过 5 条***评论,而且价格昂贵。
【讨论】:
【参考方案5】:或者,您可以使用 SerpApi 等第三方解决方案来抓取任何地方的所有评论。这是一个免费试用的付费 API。
每页包含 10 个结果。要实现分页,只需使用定义结果偏移量的start
参数(例如,0
(默认)是结果的第一页,10
是结果的第二页,20
是结果的第三页结果等)
示例 python 代码(其他库中也有):
from serpapi import GoogleSearch
params =
"engine": "google_maps_reviews",
"place_id": "0x89c259a61c75684f:0x79d31adb123348d2",
"api_key": "SECRET_API_KEY"
search = GoogleSearch(params)
results = search.get_dict()
reviews = results['reviews']
示例输出:
"reviews": [
"user":
"name": "Waylon Bilbrey",
"link": "https://www.google.com/maps/contrib/107691056156160235121?hl=en-US&sa=X&ved=2ahUKEwiUituIlpTvAhVYCc0KHbvTCrgQvvQBegQIARAx",
"thumbnail": "https://lh3.googleusercontent.com/a-/AOh14GjOj6Wjfk1kSYjhvH7WIBNMdl4nPj6FvUhvYcR6=s40-c0x00000000-cc-rp",
"reviews": 1
,
"rating": 4,
"date": "a week ago",
"snippet": "I've been here multiple times. The coffee itself is just average to me. The service is good (the people working are nice). The aesthetic is obviously what brings the place some fame. A little overpriced (even for NY). A very small cup for $6 where I feel like the price comes from the top rainbow foam decor , when I'm going to cover it anyways. If it's for an insta pic then it may be worth it?"
,
"user":
"name": "Amber Grace Sale",
"link": "https://www.google.com/maps/contrib/106390058588469541899?hl=en-US&sa=X&ved=2ahUKEwiUituIlpTvAhVYCc0KHbvTCrgQvvQBegQIARA7",
"thumbnail": "https://lh3.googleusercontent.com/a-/AOh14Gj84nHu_9V_0V4yRbZcr-8ZTYAHua6gUBP8fC7W=s40-c0x00000000-cc-rp-ba3",
"local_guide": true,
"reviews": 33,
"photos": 17
,
"rating": 5,
"date": "2 years ago",
"snippet": "They really take pride in their espresso roast here and the staff is extremely knowledgeable on the subject. It’s also a GREAT place to do work although a table is no guarantee; you might have to wait for a bit. My almond milk cappuccino was very acidic at the end which wasn’t expected but I could still tell the bean was high quality. Their larger lattés they put in a tall glass cup which looks really really cool. Would definitely go again.",
"likes": 2,
"images": [
"https://lh5.googleusercontent.com/p/AF1QipMup24_dHrWtNN4ZD70EPsiRMf_tykcUkPw6A1H=w100-h100-p-n-k-no"
]
,
"user":
"name": "Kelvin Petar",
"link": "https://www.google.com/maps/contrib/100859090874785206875?hl=en-US&sa=X&ved=2ahUKEwiUituIlpTvAhVYCc0KHbvTCrgQvvQBegQIARBG",
"thumbnail": "https://lh3.googleusercontent.com/a-/AOh14GhdIvUDamzfPqbYIpwhnGJV2XWSi77iVXfEsiKS=s40-c0x00000000-cc-rp",
"reviews": 3
,
"rating": 4,
"date": "3 months ago",
"snippet": "Stumptown Cafe is the perfect place to work or catch up with friends. Never too loud, never too dead. Their lattes and deliciously addicting and the toasts are tasty as well. Wifi is always fast, which is a huge plus! The staff are the friendliest, I highly recommend this place!"
,
...
]
您可以查看documentation了解更多详情。
免责声明:我在 SerpApi 工作。
【讨论】:
以上是关于从 Google Places API 获得超过 5 条评论的主要内容,如果未能解决你的问题,请参考以下文章
使用 Google Places API 获得 20 多个结果
Google Places API Autocomplete 仅获取城市列表