Reputation: 19
I've been searching on the web to find a solution, but I find nothing, so I try here !
I get Google Reviews of a place from Google My Business API (https://developers.google.com/my-business/reference/rest/v4/accounts.locations.reviews/list?hl=fr). It's working well, but I was looking to add one more thing to my reviews datas : it's the link to see the specific advice.
I see that some online widgets tools purpose the link to the advice on Google Maps, like here https://elfsight.com/blog/2022/09/working-with-google-maps-reviews-api/#demo when you click on "Posted on Google", like this for exemple : https://www.google.com/maps/contrib/109534324184565131216/place/ChIJAQBwK_1YwokRZXToEz7Wgs4 but I have no idea how they get this link. Is it from a Google API ? If someone has an idea of how I can generate this kind of URL. I have this part of the URL "/place/ChIJAQBwK_1YwokRZXToEz7Wgs4", but I don't knwo how to get the review ID in that URL (109534324184565131216).
I also see on another tool here https://www.reviewsmaker.com/widget/ that they get another kind of URL, like this : https://www.google.com/maps/reviews/data=!4m8!14m7!1m6!2m5!1sChZDSUhNMG9nS0VJQ0FnSUNSaDRQd0lREAE!2m1!1s0x0:0xe888e88f1ea3a80d!3m1!1s2@1:CIHM0ogKEICAgICRh4PwIQ%7CCgsI5N3XoQYQ4O7jaA%7C?hl=en-US, but it's the same, I really don't know how they get this URL.
I guess there is a way to get single review URL, but it's not possible with only the Google My Business API, the only thing we have it's an ID like this : AbFvOqlTjBYv4Ztx_dT-eGdXFJunLkfRaF6pXT__Z8SSI5gyhBMBH0hZZDUhuGf90L8bNTMz1Sq_
Thank you if anyone can help me about it !
I was looking on Google APIS, but can't find any clue of how the tools get the URL.
I see that we can get reviews from place API but it only get 5 reviews, and I don't see any ID like there is in this url for exemple (https://www.google.com/maps/contrib/109534324184565131216/place/ChIJAQBwK_1YwokRZXToEz7Wgs4) in return.
Upvotes: 1
Views: 1734
Reputation: 190
I've just encountered this problem and after a day of research I've concluded:
As you have pointed out, one way to construct a review URL is like this - https://www.google.com/maps/contrib/{user-id}/place/{place-id}
You easily obtain a place-id
with the Google Maps APIs, however there is no way to obtain a user-id
for a review.
Possible Solution
To get a Google user-id
from a review, go to a Google business page with a review and inspect the page source. In the minified <script>
at the top you can find urls containing the user ids of the reviewers.
Using a scraping library, after you can figure out how the DOM elements are bound to the script and you can programatically construct your URLs.
Alternatively, there are paid APIs like Podium, or public repos on Github that have addressed this problem.
Upvotes: 0