lib/content_link_parser.rb in cobweb-0.0.25 vs lib/content_link_parser.rb in cobweb-0.0.26
- old
+ new
@@ -10,11 +10,10 @@
base_url = @url.to_s
if @doc.at("base[href]")
base_url = @doc.at("base[href]").attr("href").to_s
end
- @absolutize = Absolutize.new(base_url, :output_debug => false, :raise_exceptions => false, :force_escaping => false, :remove_anchors => true)
@options[:tags] = {}
@options[:tags][:links] = [["a[href]", "href"], ["frame[src]", "src"], ["meta[@http-equiv=\"refresh\"]", "content"], ["link[href]:not([rel])", "href"], ["area[href]", "href"]]
@options[:tags][:images] = [["img[src]", "src"]]
@options[:tags][:related] = [["link[rel]", "href"]]
@@ -55,18 +54,17 @@
def find_matches(array, selector, attribute)
if attribute.kind_of? String or attribute.kind_of? Symbol
@doc.css(selector).each do |tag|
begin
- uri = @absolutize.url(tag[attribute])
- array << uri.to_s
+ array << Addressable::URI.parse(tag[attribute]).to_s
rescue
end
end
elsif attribute.instance_of? Regexp
@doc.css(selector).each do |tag|
begin
- tag.content.scan(attribute) {|match| array << @absolutize.url(match[0])}
+ tag.content.scan(attribute) {|match| array << Addressable::URI.parse(match[0]).to_s}
rescue
end
end
end
end