谷歌翻译API文本到语音:http请求被禁止 [英] Google Translate API text-to-speech: http requests forbidden

查看:712
本文介绍了谷歌翻译API文本到语音:http请求被禁止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个语言学习网络应用程序,当你将鼠标悬停在单词上时,它会为你发音。我想从Google Translate API访问母语翻译。



我发现此资源,它给出 http://translate.google.com/translate_tts 作为基本网址, tl 用于目标语言, q 用于查询字符串。

当我在浏览器中访问它时非常棒,
http:// translate .google.com / translate_tts?tl = zh-CN& q =你好,但是我的应用程序的任何httprequests都会返回一个403 Forbidden错误。


localhost:〜me $ wget
http://translate.google.com/translate_tts?ie=UTF-8&tl=en&q=hello+world
--2015-06-02 11 :02:06-- http://translate.google.com/translate_tts?ie=UTF-8&tl=en&q=hello+world
正在解析translate.google.com ... 173.194.123.38,173.194.123.36,
173.194.123.32,...正在连接到translate.google.com | 173.194.123.38 |:80 ...已连接。 HTTP请求
发送,等待响应... 403 Forbidden 2015-06-02 11:02:07错误
403:禁止。


是否有正式的Google API用于与传统Google翻译API的付款计划相关联的文字转语音?我只是没有找到?或者有没有办法<获得并以某种方式播放此音频?

该资源已过时。 Google不赞成免费使用语言翻译API。现在需要一个API密钥。 api现在还在V2中。



如果没有api密钥,您将收到403禁止的错误。



更多信息,请访问: https://cloud.google.com/translate/docs


I am making a language learning web app that when you hover over the word, it pronounces it for you. I'd like to access the native speaker translations from Google Translate API.

I've found this resource which gives http://translate.google.com/translate_tts as the base URL and tl for target language and q for the query string.

This works awesome when I just access it in the browser, http://translate.google.com/translate_tts?tl=zh-CN&q=你好, but any httprequests for my app return a 403 Forbidden error.

localhost:~ me$ wget "http://translate.google.com/translate_tts?ie=UTF-8&tl=en&q=hello+world" --2015-06-02 11:02:06-- http://translate.google.com/translate_tts?ie=UTF-8&tl=en&q=hello+world Resolving translate.google.com... 173.194.123.38, 173.194.123.36, 173.194.123.32, ... Connecting to translate.google.com|173.194.123.38|:80... connected. HTTP request sent, awaiting response... 403 Forbidden 2015-06-02 11:02:07 ERROR 403: Forbidden.

Is there a formal Google API for text-to-speech associated with their payment plans for traditional Google Translate API that I'm just not finding? Or is there a way to get and play this audio somehow?

解决方案

That resource is dated. Google deprecated free access to the language translate api. Now an API key is needed. The api is also now in V2.

Without an api key you will receive the 403 forbidden error.

More information here: https://cloud.google.com/translate/docs

这篇关于谷歌翻译API文本到语音:http请求被禁止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆