Skip to content

Instantly share code, notes, and snippets.

@opsb
Created March 23, 2012 15:04
Show Gist options
  • Select an option

  • Save opsb/2171502 to your computer and use it in GitHub Desktop.

Select an option

Save opsb/2171502 to your computer and use it in GitHub Desktop.
google translate proxy
require 'sinatra'
require 'open-uri'
require 'cgi'
get '/' do
content_type "audio/mpeg"
query_string = params.map{ |k,v| "#{k}=#{CGI.escape(v)}" }.join("&")
uri = "http://translate.google.com/translate_tts?" + query_string
open(uri, "User-Agent" => "Mozilla/5.0")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment