Google Places API:获取所有用户的评论

Mag*_*esh 5 review google-places-api

我们正在与google places api合作.我们希望在Google地方查看所有用户对商家的评价,但我们注意到文档说它只返回五个用户评论的数组.

现在,我们想知道有没有办法获得所有用户的评论?

Mil*_*vic 2

要获得任何地方的所有评论,您必须使用第三方解决方案,例如 SerpApi。这是一个可免费试用的付费 API。

\n

每页有 10 个结果。要实现分页,只需使用start定义结果偏移量的参数(例如,0(默认)是结果的第一页、10是结果的第二页、20是结果的第三页等)。

\n

示例 python 代码(也可在其他库中找到):

\n
require \'path/to/google_search_results\';\n\n$query = [\n  "engine" => "google_maps_reviews",\n  "place_id" => "0x89c259a61c75684f:0x79d31adb123348d2",\n  "api_key" => "SECRET_API_KEY"\n];\n\n$search = new GoogleSearch();\n$results = $search->json($query);\n$reviews = $result->reviews;\n
Run Code Online (Sandbox Code Playgroud)\n

JSON 输出示例:

\n
"reviews": [\n  {\n    "user": {\n      "name": "Waylon Bilbrey",\n      "link": "https://www.google.com/maps/contrib/107691056156160235121?hl=en-US&sa=X&ved=2ahUKEwiUituIlpTvAhVYCc0KHbvTCrgQvvQBegQIARAx",\n      "thumbnail": "https://lh3.googleusercontent.com/a-/AOh14GjOj6Wjfk1kSYjhvH7WIBNMdl4nPj6FvUhvYcR6=s40-c0x00000000-cc-rp",\n      "reviews": 1\n    },\n    "rating": 4,\n    "date": "a week ago",\n    "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?"\n  },\n  {\n    "user": {\n      "name": "Amber Grace Sale",\n      "link": "https://www.google.com/maps/contrib/106390058588469541899?hl=en-US&sa=X&ved=2ahUKEwiUituIlpTvAhVYCc0KHbvTCrgQvvQBegQIARA7",\n      "thumbnail": "https://lh3.googleusercontent.com/a-/AOh14Gj84nHu_9V_0V4yRbZcr-8ZTYAHua6gUBP8fC7W=s40-c0x00000000-cc-rp-ba3",\n      "local_guide": true,\n      "reviews": 33,\n      "photos": 17\n    },\n    "rating": 5,\n    "date": "2 years ago",\n    "snippet": "They really take pride in their espresso roast here and the staff is extremely knowledgeable on the subject. It\xe2\x80\x99s 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\xe2\x80\x99t expected but I could still tell the bean was high quality. Their larger latt\xc3\xa9s they put in a tall glass cup which looks really really cool. Would definitely go again.",\n    "likes": 2,\n    "images": [\n      "https://lh5.googleusercontent.com/p/AF1QipMup24_dHrWtNN4ZD70EPsiRMf_tykcUkPw6A1H=w100-h100-p-n-k-no"\n    ]\n  },\n  {\n    "user": {\n      "name": "Kelvin Petar",\n      "link": "https://www.google.com/maps/contrib/100859090874785206875?hl=en-US&sa=X&ved=2ahUKEwiUituIlpTvAhVYCc0KHbvTCrgQvvQBegQIARBG",\n      "thumbnail": "https://lh3.googleusercontent.com/a-/AOh14GhdIvUDamzfPqbYIpwhnGJV2XWSi77iVXfEsiKS=s40-c0x00000000-cc-rp",\n      "reviews": 3\n    },\n    "rating": 4,\n    "date": "3 months ago",\n    "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!"\n  },\n  ...\n]\n
Run Code Online (Sandbox Code Playgroud)\n

您可以查看文档以了解更多详细信息。

\n

免责声明:我在 SerpApi 工作。

\n