lib/scraper/modules/video.rb in cyx-scraper-0.3.1 vs lib/scraper/modules/video.rb in cyx-scraper-0.4.0

- old
+ new

@@ -1,8 +1,5 @@ -require 'nokogiri' -require 'open-uri' - module Scraper module Modules module Video module HostNameMatching def =~( args ) @@ -19,40 +16,12 @@ host_name.match(config[:valid_host_name]) end end module Common - def self.included( base ) - base.cattr_accessor :config - end - - def title - @title ||= doc.search(config[:title_selector]).first.content - end - - def description - return @description if @description - - html = doc.search(config[:description_selector]).first.inner_html - @description = dom(html.gsub(/<br\/?>/, ' ')).content.strip - end - def video_id @video_id end - - protected - def dom( html ) - Nokogiri::HTML( html ) - end - - def uri - @uri.scheme + '://' + @uri.host + @uri.request_uri - end - - def doc - @doc ||= dom( Modules::Web.open( uri ).read ) - end end end end end \ No newline at end of file