Sha256: 94af4314a5e8c41140e078189d24d2e5af382fd5de8328ef920cff3c7b13f684
Contents?: true
Size: 641 Bytes
Versions: 1
Compression:
Stored size: 641 Bytes
Contents
require 'nokogiri' require 'httpclient' require 'nokogiri' require 'capybara' require 'capybara/poltergeist' module VagueScraper class Driver class << self def call(url) Capybara.register_driver :poltergeist do |app| Capybara::Poltergeist::Driver.new(app, { js_errors: false, timeout: 1000 }) end Capybara.default_selector = :xpath session = Capybara::Session.new(:poltergeist) session.driver.headers = { 'User-Agent' => @user_agent } session.visit url Nokogiri::HTML(session.html).tap do session.driver.quit end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vague_scraper-0.1.1 | lib/vague_scraper/driver.rb |