So I am able to successfully get a list of places but I just realized that the results do not contain the URL for the establishment. For e.g. I get Pizza Hut and the physical address for it but I do not get the URL for it (www.pizzahut.com). Is there a way to get this may be by doing an additional query?
If the external website is available for the place, it should be set in website in the query result. If url is set, then that is the Google Place Page URL entered for the establishment. The reference result may be used to query for the same place later. (Documentation)
Related
I want to get literally every search result from a certain term. For example if I have the term "dentist las vegas" I want to get at least 5000 results with all links google provides.
I want to make it with jsoup. Do anyone have a sample code for me please?
You can use Google Maps Platform's Text Search Request if you wish to get the results of all "dentists in Las Vegas" including their websites and other information. The service is especially useful for making ambiguous address queries in an automated system, and non-address components of the string may match businesses as well as addresses.
Below is a sample request:
https://maps.googleapis.com/maps/api/place/textsearch/json?query=dentists+in+Las+Vegas&key=YOUR_API_KEY
There's an optional parameter "pagetoken" wherein it returns up to 20 results from a previously run search. Setting a pagetoken parameter will execute a search with the same parameters used previously — all parameters other than pagetoken will be ignored.
How do I find all of the facebook_places_id's in Brooklyn? I need them to scrape Instagram's public website.
I am able to lookup places_id's for a single location by name. I am also able to query all photos/videos and metadata once I have the location ID. All of this is available without needing an access token.
Look up facebook_places_id 's
This url allows you to look up location_ids by name. For example, this returns close matches for "Brooklyn, New York" (you can enter this into any browser and see the result, no access key or login required. I recommend Firefox):
https://www.instagram.com/web/search/topsearch/?context=place&query=brooklyn+new+york
From the JSON returned, we can see that "Brooklyn, New York" has the facebook_places_id 212950988
Scrape metadata for a given facebook_places_id
This url will return JSON metadata about posts in Brooklyn:
https://www.instagram.com/graphql/query/?query_id=17881432870018455&id=212950988&first=12&after=0"
So I can get everything I want if I know the place, I just need a full list of places to ask for.
https://www.instagram.com/web/search/topsearch/?context=place&query=brooklyn+new+york
The id you get from the above API call is not facebook_places_id, it is instagram_location_id that you use in API call to get location posts.
Below is Facebook Graph API call to get facebook_places_id in one city or region specified by lat,lng and distance. However this required a facebook access_token
https://graph.facebook.com/search?q=coffee&type=place¢er=45.5230622,-122.67648150000002&distance=5000&access_token=XXX
You can get the list of facebook_places_id and then use the below API call to get corresponding instagram_location_id, which you can use to get location posts data.
https://api.instagram.com/v1/locations/search?facebook_places_id=694471784029871&access_token=XXX
This API call requires a instagram access_token
I'd like to programatically get a list of all of the valid place types for search requests. I can look at the list here, but would like to be able to query the server and get a json list so I can keep it up to date automatically instead of having to check the linked page periodically.
Is there an API for that?
I understand the usage limits for the Google places API.
However, once you have made a place details request, occasionally a location will have several photos available to it.
You can then retrieve the URL for these photos by using the following function:
photo.getUrl(maxWidth:200,maxHeight:200);
This works find and the actual URL of the image is returned. No ajax request appears to be made to Googles API, it simply returns a URL which you can then dynamically add to your DOM.
The URL's returned are like so:
https://lh4.googleusercontent.com/-SG8x8m7avHc/UWm8kgkkKTI/AAAAAAAAAA8/6_wM5YoSnlk/w1280-h1280-s0/2013-04-13
What I need to know is if accessing these images has any kind of usage limit attached to it.
Does each view count as one Google Places API request? Or are all views essentially free and it is only the initial Place details request which counts towards usage.
I know this question is old but it still isn't answered, so I'll try my best.
Does accessing these images have any kind of usage limit attached to it?
No, once you've successfully requested a place result using the Places API you are free to request as many image URLs relating to that result as you'd like with no usage limitations on the Places API itself.
However, Google will limit the number of images you may receive if you don't have a premium plan. So for instance, if you were to make 200 image URL requests for 'The Eiffel Tower', you might only receive up to 15 (or less) images if you're on a free plan. I know that sucks right.
Does each view count as one Google Places API request? Or are all views essentially free and it is only the initial Place details request which counts towards usage
If you're referring to image URL requests as a "view". Then the latter is true. Each image source requested won't increment the usage of the API.
If you're still uncertain here's a link to the Place Photo requests method in the Google Maps Places API Documentation
Each page of results must be displayed before displaying the next page of results. Note that each search counts as a single request against your usage limits.
refer here
I want to send a request to the google places (not google place API), I don't need to get the data in XML or JSON, i just want to get the place page and display it to the user.
This url works for me http://maps.google.com/maps/place?cid=2124238351431937390 but I was wondering how to get this "cid", this seems to a unique id for a business. I went to get a sample response from the google place api but didnt find this cid for the same business as any of the response fields.
Does anyone know how can I get this "cid"?
Thanks
Nishant
Here's how to get the cid of a place. Put your own API key and name of the restaurant that you want to find the cid).
Step 1: Call Places Request API something like this
https://maps.googleapis.com/maps/api/place/search/json?
location=47.6757453,-122.3149514&
radius=500&
types=food&
name=Pies&
sensor=false&
key=AIzaSyZZZZZZZZZZZZ
These urls are one line. They are broken into multiple lines to make it easier to read.
Note the name parameter is the restaurant called "Pies and Pints" for which I want to get the cid, lat&lng is the location information of the same place.
The response will contain a "reference" key which is unique for every place.
Step 2: Take the "reference" value from above and call Places Details API, something like this:
https://maps.googleapis.com/maps/api/place/details/json?
reference=CnRiAAAATIbN_GasBkBS6xLoO_HzR7owHvGaDXbG5QIbLf7eSZtIc4ZpvbBPxhVPEKZs5c4ptqxeKNVLCXZEoSOwLMn9nqkRc6khFuJFPh5jy-hjrh3Xr7X75w3-TIoTl3E-dKiZ2LcHuReWKZxydI75vH6zyRIQxfoiOKfFjo_1O-hnnllafxoU9tU_HoZos8C5uWextAk08RMukCY&
sensor=true&
key=AIzaSyBnI5DyG7ZZZZZZZZZZZZ
Check the response of this API, the key "url" contains the "cid".
Consult the google places documentation to learn more about their APIs.
It looks like the URL no longer contains the CID but rather the plus.google.com link
To get the CID in Google Maps Places Details API you just pass the URL value in the fields parameter. This will get you the URL of the particular location and there you can find the CID.
"url": "https://maps.google.com/?cid=12XXXXXXXXXXXXXXX"