lib/video_grabber/scraper.rb in video_grabber-1.5.0 vs lib/video_grabber/scraper.rb in video_grabber-1.6.0
- old
+ new
@@ -1,18 +1,18 @@
module VideoGrabber
class Scraper
attr_reader :url, :browser, :timeout, :keep_browser_open, :headless_enabled,
- :firefox_extension_path, :profile, :attributes
+ :firefox_extension_path, :profile, :html_attributes
def initialize(config)
@keep_browser_open = config.keep_browser_open
@url = config.url
@timeout = config.timeout
@headless_enabled = config.headless_enabled
@firefox_extension_path = config.firefox_extension_path
- @attributes = config.attributes
+ @html_attributes = config.html_attributes
end
def start
open_browser
browser.goto(url) ; self
@@ -72,16 +72,16 @@
rescue Selenium::WebDriver::Error::WebDriverError => e
raise ::VideoGrabber::ExtensionError, e
end
def add_attributes(list)
- return unless attributes
+ return unless html_attributes
list.map do |element|
parsed_element = Nokogiri::XML(element)
- attributes.each do |key, value|
+ html_attributes.each do |key, value|
parsed_element.xpath('//video').first.set_attribute(key, value)
end
parsed_element.xpath('//video').to_s
end