Module: Irasutoya::Modules::HasDocumentFetcher::Methods

Defined in:
lib/irasutoya/modules/has_document_fetcher.rb

Instance Method Summary collapse

Instance Method Details

#fetch_page_and_parse(url) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/irasutoya/modules/has_document_fetcher.rb', line 13

def fetch_page_and_parse(url)
  charset = nil
  html = URI.parse(url).open do |f|
    charset = f.charset
    f.read
  end
  Nokogiri::HTML.parse(html, nil, charset)
end