Created
March 9, 2010 22:55
Revisions
-
tomriley created this gist
Mar 9, 2010 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ require 'rubygems' require 'hpricot' require 'open-uri' phrase = "Welcome too mountain view" mp3s = [] phrase.split(' ').each do |word| doc = Hpricot(open("http://www.google.com/dictionary?aq=f&langpair=en%7Cen&hl=en&q=#{word}")) a = doc.search('#pronunciation a')[0] if a href = a.attributes['href'] `curl -qO #{href}` mp3s << href.split('/').last end end mp3s.each do |mp3| `afplay #{mp3}` end