Skip to content

Instantly share code, notes, and snippets.

@yosmoc
Created January 18, 2009 05:20
Show Gist options
  • Save yosmoc/48551 to your computer and use it in GitHub Desktop.
Save yosmoc/48551 to your computer and use it in GitHub Desktop.
require 'nokogiri'
require 'net/http'
$KCODE = 'u'
def lou(text)
req = Net::HTTP::Post.new('/?')
Net::HTTP.version_1_2
Net::HTTP.start('lou5.jp') do |http|
res = http.request(req, "text=#{text}")
doc = Nokogiri::HTML.parse(res.body, nil, 'utf-8')
doc.css('textarea[id="lou"]').text
end
end
Termtter::Client.add_command /^(lou)\s+(.*)$/ do |m, t|
langpair = m[1].gsub('2', '|')
puts "translating lou..."
msg = "#{lou(m[2])}"
puts msg
t.update_status msg
end
# This plugin does not work yet.
# requirements
# nokogiri (sudo gem install nokogiri)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment