Class: Camdict::HTTP::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/camdict/http_client.rb

Class Method Summary collapse

Class Method Details

.get_html(url, agtstr = AGENT) ⇒ Object

Download a html page from a remote site, and return a Nokogiri::HTML url will be escaped by this method, and default agtstr is AGENT.



14
15
16
17
# File 'lib/camdict/http_client.rb', line 14

def self.get_html(url, agtstr=AGENT)
  url = URI.escape(url)
  Nokogiri::HTML(open(url, "User-Agent"=>agtstr))
end