I posted this question on SO to get Google Translate Text-To-Speech to work.
Google Translate API text-to-speech: http requests forbidden
I was told I needed a key and to enable billing. I've since done that. I know billing is enabled because, using their specified endpoint for words-only translations (not narrated speech) (GET https://www.googleapis.com/language/translate/v2?key=INSERT-YOUR-KEY&source=en&target=de&q=Hello%20world
), I'm able to get a response both in DHC and in my application $.get
:
In my original question (above), I was told If I get an API key, I would no longer be blocked from getting text-to-speech. I tested the request for Text-to-speech in DHC and Postman:
https://translate.google.com/translate_tts?key=myKeyHere&ie=utf-8&tl=zh-CN&q=你好
And got a 200:
Excellent. However, in my application, I make a get
request:
$.get('https://translate.google.com/translate_tts?key='+myKey+'&ie=utf-8&tl=en&q=Hello+world',
function (returned_data) {
I get blocked:
No 'Access-Control-Allow-Origin' header
Why is this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…