lib/yasf/scraper.rb in yasf-0.0.4 vs lib/yasf/scraper.rb in yasf-0.0.5
- old
+ new
@@ -1,9 +1,11 @@
require "nokogiri"
+require "httparty"
module Yasf
class Scraper
+ include HTTParty
class << self
def extract_from(source, options = nil)
self.new(source, options).extract
@@ -114,10 +116,10 @@
# The argument +source+ is a String (url format), or Nokogiri::XML::Element
def initialize(source, options = nil)
@options = options || {}
case source
when String
- @document = Nokogiri::HTML(open(source))
+ @document = Nokogiri::HTML(self.class.get(source,@options).body)
when Nokogiri::XML::Element
@document = source
else
raise ArgumentError, "source not recognized"
end