require 'open-uri' require 'cgi' def lex_url source_code, target_code, title url = "http://panda.blogamundo.com/lexicons/%s/%s/%s" title = CGI.escape(title) return url % [source_code, target_code, title] end url = lex_url('ja','ca', '日本') puts open(url, {'User-Agent'=>'Innocentrobot', :http_basic_authentication => ['guest', 'xxxxx']}).read