Skip to content

Instantly share code, notes, and snippets.

@igul222
Created December 11, 2012 05:23
Show Gist options
  • Select an option

  • Save igul222/4256102 to your computer and use it in GitHub Desktop.

Select an option

Save igul222/4256102 to your computer and use it in GitHub Desktop.
Gangsta-to-english
require 'mechanize'
module Gangsta
def self.to_gangsta(english)
agent = Mechanize.new
page = agent.get "http://gizoogle.net/textilizer.php"
search_form = page.form_with :name => "query"
search_form.field_with(:name => "translatetext").value = english
search_results = agent.submit search_form
search_results.body[/<textarea type="text" name="translatetext" style="width: 600px; height:250px;"\/>(.*)<\/textarea>/]
$1
end
end
puts Gangsta.to_gangsta('hello person')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment