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.
Related
I am using Google Places API Text Search to fetch for pharmacies and looks like it isn't filtering address correctly.
When I search for Walgreens, it returns some results from Broadlands, Herndon and some other locations.
If I search for Walgreens Broadlands or Walgreens Herndon, it returns nothing.
But if I search for Walgreens Miami or Walgreens Village it returns correctly.
Other strange behaviour is that, sometimes, executing the same request two times returns different results. For that reason, I don't know if you will get the same results using the links I provided.
Google documentations states the following:
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. Examples of ambiguous address queries are incomplete addresses, poorly formatted addresses, or a request that includes non-address components such as business names.
From my understanding, the examples I gave should work just fine.
Am I missing something? What is wrong in these cases?
It sounds like a bug, I would suggest filing an issue in Google Issue tracker for Places API.
The unique workaround I can think about is providing an additional information about the area where you are searching the Walgreens pharmacy. I believe the queries with location bias work better than without it. If I use the coordinate of Broadlands (39.0181644,-77.5202688) and specify radius of 50 km, the Places API text search for Walgreens return results
https://maps.googleapis.com/maps/api/place/textsearch/json?query=walgreens&location=39.0181644%2C-77.5202688&radius=50000&type=pharmacy®ion=US&key=MY_API_KEY
as shown in the screenshot
I hope this helps!
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)
I've never used the google-maps api, but I just want to do one particular thing.
I've got around 1000 user typed street addresses. Some are missing states and postcodes. I've noticed if I type these addresses into google maps it generally gives me back the state and postcode (only very rarely it gives some options). Is there a way to do this programatically, so I don't have to manually copy/paste this in? Has someone already made an application/library to do this that I can just feed the user typed data to?
Edit:
I've noticed this does the job:
https://maps.google.com.au/maps?q=1%20George%20st%20sydney
It returns state and postcode. But it returns it on a webpage with a whole lot of other stuff. I just want the address only. I guess I could grep through the results, but some additional thing to add to the query string so it only returns the raw address (or some structure) would be useful.
You can use the Geocoding API - https://developers.google.com/maps/documentation/geocoding/
E.g. http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=1%20George%20st%20sydney ; you can replace "json" with "xml" if you prefer. Look for "formatted_address" in the result, or individual address components, depending on what you need.
However, I'm quite frustrated that it sometimes doesn't work, even for some cases where the regular google maps search is successful.
I followed this example and successfully built a store locator:
http://gmaps-samples-v3.googlecode.com/svn/trunk/localsearch/places.html
My problem is that some searches do not return any results when the search location is not near a well populated area. To see what I mean you can load the example URL above and try either search below which combines the "T-Mobile" Keyword with the zip for either Death Valley, CA or Yosemite Valley, CA:
T-Mobile 92328
T-Mobile 95389
The Google API is not sending any results for either of these ZIP codes. (Makes sense since there are probably no T-Mobile stores within a great distance)
I need to find a way to handle this and did extensive research but found nothing. Is there a way to either:
Widen the search area if the Google API does not return a result to include at least 1 result.
Start with a wider search area to minimize the occurrences of no T-Mobile stores being found within a given area?
Thanks for your time!
I'm losing some hair over Google's AJAX API currently. What I do is turning structured location data into a Google local search API query in order to give users an alternative result list of places.
ex.:
http://ajax.googleapis.com/ajax/services/search/local?v=1.0&key=XXX&hl=en_US&mrt=localonly&rsz=large&q=pizza+Neustadt+DE
However, the API behaves very oddly at times, often not taking into account certain parameters I pass to it. For instance:
If I search for "term Rome Roma IT" on Google Maps, then it finds all terms in Rome as expected. If I repeat the same search on the API, I get zero results (I have to remove either 'Roma' or 'Rome' for it to work -- Roma is the administrative region here, and Rome the city name).
Why is that?
Another example. There is like 20 different towns, cities and boroughs called Neustadt in Germany. Now, when I search on Google Maps, it only finds one, unless I specify an additional qualifier, like a region or something.
Now, on the API level I kinda expected that when passing lat/lon parameters along with a query for Neustadt then it would be clever enough to pick the correct Neustadt by looking at the geo coding. But that doesn't happen, it always picks the same Neustadt and ignores the geo data.
q=pizza+Neustadt+DE&sll=48.8053,11.7579
I had similar problems when doing bounding box searches. The bounding box seems to be ignored completely, since I'm still getting result data which is a hundred kilometers off:
q=pizza+Neustadt+DE&sll=48.8053,11.7579&sspn=0.00001,0.00001
The last result is not even in the same city; shouldn't the tiny bounding box not result in any data whatsoever? I could even pass a zero size BBox and I would still get results.
I know there's an actually quite extensive documentation for the Local Search API, but it never goes into detail about which parameters are used when and how a query has to be structured and is evaluated, which makes it very difficult to get decent results.
Do you have any hints, tipps, suggestions on how to get to grips with Google Local search?
UPDATE:
I just found something REALLY odd. Could someone please go to this website:
http://code.google.com/apis/ajaxsearch/documentation/localsearch/index.html
open firebug, and monitor the HTTP traffic when typing in this search query:
test Rome Roma IT
You will get a bunch of results on the map. Now copy the URL that was contacted via AJAX and send a request to it on the command line:
curl "http://www.google.com/uds/GlocalSearch?key=internal-sample&v=1.0&rsz=large&sll=41.97684819454683%2C12.486648559570312&sspn=0.204185%2C0.549316&q=test%20Rome%20Roma%20IT&lssrc=lsc&lscstyle=final&start=0&callback=_callbacks_._5g139yfuc"
Now I get ZERO results. How can that possibly be? It's definitely not the key or callback args, I removed them without any change to the outcome of that query.
Is Google extending their search results when a query comes from one of their servers?
I've encountered exactly this same problem and it seems to be down to a combination of licensing issues and the fact that what Google exposes via its APIs and what it displays in the Maps/Google search pages are a combination of different searches (search, maps, base, data etc.etc.)
On the licensing issue, it seems that Google can display more information when a user goes via the browser, compared to requests via API calls (which could theoretically be automated).
See here for example.