How to Get Google Place IDs from CIDs

0
7
Asked By TechNoWizard92 On

I'm developing a tool to process Google Maps URLs, and I need to reliably get the Place ID (which follows the ChIJ... format) for each business. From the Maps URL, I can extract the CID easily, such as 0x487baf8d5fdb7b89:0xd927957786dc2e9e, but I really want the Place ID for use with the Places API. I've tried different methods, including calling the Place Details API with the CID, but I get an INVALID_REQUEST error. Using the Geocoding API gives me an address-level place_id rather than the business ID, and Nearby Search and Text Search have been inconsistent. Currently, my fallback is to get the lat/lng from the URL, try nearby searches by business name, fallback to text search, and if all else fails, link to Google search. I'm looking for a dependable method to convert CID to Place ID or to extract the Place ID directly from a Maps URL without resorting to scraping. Any thoughts or insights would be appreciated!

4 Answers

Answered By QueryMaster44 On

Did you end up finding a solution for this issue? I'm curious if you got it figured out!

Answered By HelpfulNerd34 On

You might want to check out the dataforseo API—it could have what you're looking for. Google does have some APIs, but they can be a bit tricky to navigate for this specific use case.

Answered By SolutionSeeker01 On
Answered By DataCruncher77 On

For the Place Details API, make sure you use the decimal conversion of the second part of the CID. Take that hex value, convert it to decimal using `int('d927957786dc2e9e', 16)`, and then use that as your CID in the request. I had the same issue and that's usually where the INVALID_REQUEST comes from. You should be able to access the correct business listing this way.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.