Created
January 18, 2009 05:20
-
-
Save yosmoc/48551 to your computer and use it in GitHub Desktop.
This file contains 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 characters
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