Sha256: bf6b05db44d77c4b9af7fe9d8978174686edebc1649315e76398911217f3ce74

Contents?: true

Size: 434 Bytes

Versions: 9

Compression:

Stored size: 434 Bytes

Contents

require 'open-uri'
require 'nokogiri'
module AtpScraper
  # Get and parse html from atpworldtour.com
  class Html
    BASE = "http://www.atpworldtour.com"
    def self.get(uri)
      charset = nil
      html = open(BASE + uri) do |f|
        charset = f.charset
        f.read
      end
      { html: html, charset: charset }
    end

    def self.parse(html, charset)
      Nokogiri::HTML.parse(html, nil, charset)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
atp_scraper-0.7.2 lib/atp_scraper/html.rb
atp_scraper-0.7.0 lib/atp_scraper/html.rb
atp_scraper-0.6.3 lib/atp_scraper/html.rb
atp_scraper-0.6.2 lib/atp_scraper/html.rb
atp_scraper-0.6.1 lib/atp_scraper/html.rb
atp_scraper-0.6.0 lib/atp_scraper/html.rb
atp_scraper-0.5.1 lib/atp_scraper/html.rb
atp_scraper-0.5.0 lib/atp_scraper/html.rb
atp_scraper-0.4.0 lib/atp_scraper/html.rb