我正在开发一个应用程序,使用Google Places API提取Google评论。当我阅读与之相关的文档时,在 "https://developers.google.com/maps/documentation/javascript/places" 中发现我只能获取5条顶级评论。是否有选项可以获取更多评论?
我正在开发一个应用程序,使用Google Places API提取Google评论。当我阅读与之相关的文档时,在 "https://developers.google.com/maps/documentation/javascript/places" 中发现我只能获取5条顶级评论。是否有选项可以获取更多评论?
不幸的是,除非您是业务所有者并经过Tekill的验证,否则在地点API中无法获得超过5个评论。 但看起来有一些外部服务可以获取所有评论。 我猜想他们直接从Google Maps上爬取这些评论: 其中一些服务是Wextractor,ReviewShake和AllReviews
或者,您可以使用第三方解决方案,例如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!"
},
...
]
补充@miguev的答案,目前没有办法在不使用高级API的情况下获取超过5个顶级评论(根据我与Google Maps的一位工作人员的交谈),而这是昂贵的。