http://maps.googleapis.com/maps/api/geocode/json?address=rome&sensor=false
OR
---------------------------------------------------------roma-------------
http://maps.googleapis.com/maps/api/geocode/json?address=Vatican%20Museum&sensor=false
If the query is Rome or Roma The result for
"types" : [ "locality", "political" ] is "long_name" : "Rome",
If the query is "Vatican Museum" The result for
"types" : [ "locality", "political" ] is "long_name" : "Roma",
and not Rome as it should be.
Is it bug of the service? I try to use language=en but it not helping.
This is complete conjecture so feel free to disregard out of hand, but my best guess is that it has to do with the address that the Maps API has stored. For instance, if you (or I, at least) try searching for the Vatican Museum in Google Maps, no result is found and the suggestion points to the Italian version. If you do a similar query for the Colosseum, you can see that your approach of using the language parameter does appear to be correct:
English
http://maps.googleapis.com/maps/api/geocode/json?address=Colosseum%20rome&sensor=false&language=en
Italian
http://maps.googleapis.com/maps/api/geocode/json?address=Colosseum%20rome&sensor=false&language=it
I'll take a look around for some more information corroborating this, but my best guess is that being able to toggle between languages depends on data for that language being available, and in this case only the Italian version is present
Related
I'm looking to get the official Twitter handle from an OS Verified project, programmatically.
I've tried calling the "collections" OS API, but the twitter_username field seems to rarely be populated with anything but "null" even for verified projects.
I've tried scraping the data manually with fetch but I got 1020 errors likely due to cloudflare protections.
Has anyone else used Moralis NFT or some other GraphHQ like service to obtain the Twitter handle of a given NFT project (starting out with a contract address)?
You can try Ubiquity API. They have an endpoint for collection metadata which also includes the Twitter account name
https://ubiquity.api.blockdaemon.com/v1/nft/ethereum/mainnet/collection?contract_address=0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D
This will give you the following response
{
"collection": {
"id": "4203aedd-7964-5fe1-b932-eb8c4fda7822",
"name": "Bored Ape Yacht Club",
"description": "The Bored Ape Yacht Club is a collection of 10,000 unique Bored Ape NFTs— unique digital collectibles living on the Ethereum blockchain. Your Bored Ape doubles as your Yacht Club membership card, and grants access to members-only benefits, the first of which is access to THE BATHROOM, a collaborative graffiti board. Future areas and perks can be unlocked by the community through roadmap activation. Visit www.BoredApeYachtClub.com for more details.",
"logo": "https://ubiquity.api.blockdaemon.com/v1/nft/media/ethereum/mainnet/collection/4203aedd-7964-5fe1-b932-eb8c4fda7822/logo.png",
"banner": "https://ubiquity.api.blockdaemon.com/v1/nft/media/ethereum/mainnet/collection/4203aedd-7964-5fe1-b932-eb8c4fda7822/banner.jpeg",
"verified": true,
"contracts": [
{
"address": "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D",
"name": "BoredApeYachtClub",
"symbol": "BAYC",
"description": "",
"image_url": "https://ubiquity.api.blockdaemon.com/v1/nft/media/ethereum/mainnet/",
"type": "ERC721"
}
],
"meta": {
"discord_url": "https://discord.gg/3P5K3dzgdB",
"external_url": "http://www.boredapeyachtclub.com/",
"twitter_username": "BoredApeYC"
},
"sub_collection": []
}
First off, I do not want to use AMAZON.Literal as it is for US only (I'm UK based) and I doubt it will be supported much longer.
I need a wildcard slot to allow users to say a place name (name of a shop for example), followed by the city.
City is easy, no problem.
The issue is the place name. I have a custom slot, but I can't list every shop in every city in the values.
I put a value of any in, which kind of works, but in my response, I'm only getting the last word if the user says a name that contains a few words e.g. Pound Land would just return Land.
Has anyone managed to do this?
As of 2018, you can use phrases to get user input that you may not be able to predefine.
{
"intents": [
{
"name": "SearchIntent",
"slots": [
{
"name": "Query",
"type": "AMAZON.SearchQuery"
},
{
"name": "CityList",
"type": "AMAZON.US_CITY"
}
],
"samples": [
"search for {Query} near me",
"find out {Query}",
"search for {Query}",
"give me details about {CityList}"
]
}
]
}
https://developer.amazon.com/blogs/alexa/post/a2716002-0f50-4587-b038-31ce631c0c07/enhance-speech-recognition-of-your-alexa-skills-with-phrase-slots-and-amazon-searchquery
When using custom slot types, AWS may return values from outside of the list yet it will try to map to the values. You can "hack" this behavior by providing a huge list of possible values. Maybe try to scrap a list of places and use that. I once tried with a list of 3000 landmarks and it was definitely returning slot values that were not in the list. The recognition was not great but I had an acoustic similarity function that allowed me to retrieve items from the list when needed. That was a while ago when they first talked about deprecating Amazon.LITERAL but eventually left it so I didn't have to worry about this.
I am doing an application where I extract the google reviews using google places API.When I read the document related to it in "https://developers.google.com/maps/documentation/javascript/places",I found out that I could get only 5 top reviews.Is there any option to get more reviews.
In order to have access to more than 5 reviews with the Google API you have to purchase Premium data Access from Google.
That premium plan will grant you access to all sorts of additional data points you have to shell out a pretty penny.
If you are a Business owner wanting to retrieve all of your reviews, you can do so but first you have to get verified and could do this through the MyBusiness API more info here: https://developers.google.com/my-business/
There is a feature request for that: Issue 7630: Response to Include More Than 5 Reviews ─ I'd recommend you "star" it to receive updates.
Unfortunately there's no way to get more than 5 reviews in the places API unless you are the business owner after getting verified as Tekill said.
But it looks like there are some external services that can get all the reviews. My guess is that they scrape them from Google Maps directly:
Some of these services are Wextractor, ReviewShake and AllReviews
Alternatively, you can use a third party solution like SerpApi to scrape all the reviews of any place. It's a paid API with a free trial.
Each page fatches 10 results. To implement the pagination just use the start parameter which defines the result offset (e.g., 0 (default) is the first page of results, 10 is the 2nd page of results, 20 is the 3rd page of results, etc.)
Example python code (available in other libraries also):
from serpapi import GoogleSearch
params = {
"engine": "google_maps_reviews",
"place_id": "0x89c259a61c75684f:0x79d31adb123348d2",
"api_key": "SECRET_API_KEY"
}
search = GoogleSearch(params)
results = search.get_dict()
reviews = results['reviews']
Example output:
"reviews": [
{
"user": {
"name": "Waylon Bilbrey",
"link": "https://www.google.com/maps/contrib/107691056156160235121?hl=en-US&sa=X&ved=2ahUKEwiUituIlpTvAhVYCc0KHbvTCrgQvvQBegQIARAx",
"thumbnail": "https://lh3.googleusercontent.com/a-/AOh14GjOj6Wjfk1kSYjhvH7WIBNMdl4nPj6FvUhvYcR6=s40-c0x00000000-cc-rp",
"reviews": 1
},
"rating": 4,
"date": "a week ago",
"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?"
},
{
"user": {
"name": "Amber Grace Sale",
"link": "https://www.google.com/maps/contrib/106390058588469541899?hl=en-US&sa=X&ved=2ahUKEwiUituIlpTvAhVYCc0KHbvTCrgQvvQBegQIARA7",
"thumbnail": "https://lh3.googleusercontent.com/a-/AOh14Gj84nHu_9V_0V4yRbZcr-8ZTYAHua6gUBP8fC7W=s40-c0x00000000-cc-rp-ba3",
"local_guide": true,
"reviews": 33,
"photos": 17
},
"rating": 5,
"date": "2 years ago",
"snippet": "They really take pride in their espresso roast here and the staff is extremely knowledgeable on the subject. It’s 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’t expected but I could still tell the bean was high quality. Their larger lattés they put in a tall glass cup which looks really really cool. Would definitely go again.",
"likes": 2,
"images": [
"https://lh5.googleusercontent.com/p/AF1QipMup24_dHrWtNN4ZD70EPsiRMf_tykcUkPw6A1H=w100-h100-p-n-k-no"
]
},
{
"user": {
"name": "Kelvin Petar",
"link": "https://www.google.com/maps/contrib/100859090874785206875?hl=en-US&sa=X&ved=2ahUKEwiUituIlpTvAhVYCc0KHbvTCrgQvvQBegQIARBG",
"thumbnail": "https://lh3.googleusercontent.com/a-/AOh14GhdIvUDamzfPqbYIpwhnGJV2XWSi77iVXfEsiKS=s40-c0x00000000-cc-rp",
"reviews": 3
},
"rating": 4,
"date": "3 months ago",
"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!"
},
...
]
You can check out the documentation for more details.
Disclaimer: I work at SerpApi.
Adding to the answer of #miguev, there's at the moment no way to get more than 5 top reviews without using premium APIs (according to a Google Maps guy I had a talk with) and that's pricey.
We tried to sign for The Google Maps Platform Premium Plan to show them on pages like this but Google said it's no longer available for sign up or new customers. Right now we're limited to 5 reviews only.
I am using Google Places API Web Service, specifically nearbysearch to search for places around me. However, some of the places names that I get are in languages other than English, some are Chinese and Arabic, I tried to include language=en in the url. However, with no luck. It is worth mentioning that same places names are in English if I look them up in www.google.com/maps
The url I am using:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=25.1677738,55.4030409&radius=500&type=food&language=en&name=&key=YourKey
Please note that I have removed my key from the url.
This is part of the result I am getting with Arabic place name
{
"geometry" : {
"location" : {
"lat" : 25.167926,
"lng" : 55.4015231
}
},
"icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/shopping-71.png",
"id" : "328ca6a7bb4dd48eb44215ed32fa5676fca8e462",
"name" : "سوبر ماركت بوماز ٢٤ساعة",
"place_id" : "ChIJlcEHXrVmXz4RJH7IVn7Rps4",
"reference" : "CoQBfwAAAI8pnOqGRA6E71Mmztnk8ueSA7kS9bn5idY3S5V0_D_JZP2F9knryHUervQXA_RZL3-9KZJH55NrX0dz4p1R1GUQbGz4jXGoDQMJemisTLpiu41dm8-wgZT6XzXsDUeLLo6QbENam3hM2gCXPzpjTu4F7GsV4t4bIX5FhDQ-SufVEhDYboMkA1reMj20kM4AAvzGGhStwclS0fE9rWQkn5LTUcxiio-3vA",
"scope" : "GOOGLE",
"types" : [
"grocery_or_supermarket",
"food",
"store",
"point_of_interest",
"establishment"
],
"vicinity" : "U2 - Italy U17 - Dubai"
}
Looked around the community for a while and found this a post that is regarding the inconsistency in the language used in Google Places API results. And as per the answer, it seems that it is actually a correct behavior, from the answer:
Even if you specify a language, it will return the response in that language only if there is one available, if not it will return the response in the language it was originally entered in.
There are workarounds included in there that I think that would be helpful.
I'm trying to use freebase to return a cities related country ISO code.
I have this MQL which works but it doesn't work on certain cities and there's probably a more straight forward way to do the same thing?
{
"id": "/en/amarillo",
"/location/location/containedby": [
"/location/country/iso3166_1_alpha2": null,
"type": "/location/country"
]
}
It doesn't work occasionally for smaller cities. Even better would be a way to use the Freebase suggest (which I use to gather the city) to return the ISO code in the same request?
jQuery ->
$("#city_name")
.suggest(type: "/location/citytown")
.bind "fb-select", (e, data) ->
$("#city_freebase_id").val data.id
That's basically how I'd do it, but, as you've discovered, the data isn't incredibly fully populated. One tweak that you could make to improve your odds of finding something would be to go up an additional level in case, for example, the city is contained by a state which is contained by a country. You're also missing a set of curly braces in your subquery which will probably cause your query to fail in the API (the query editor silently fixes up stuff like this).
A revised query that goes up an additional level and fixes the braces would look like this:
{
"id": "/en/avondale",
"/location/location/containedby": [{
"/location/country/iso3166_1_alpha2": null,
"type": "/location/country"
}],
"l2:/location/location/containedby": [{
"id":null,
"/location/location/containedby": [{
"/location/country/iso3166_1_alpha2": null,
"type": "/location/country"
}]
}]
}
The search API has an mql_output parameter that could be used to do what you want, but I'm not sure it's used by Freebase Suggest. It's not documented to be available. If it's not in the code either, it wouldn't be too hard to hack the widget to add this.