lib/cms_scanner/target.rb
def uris_from_page(page = nil, xpath = '//@href|//@src|//@data-src')
      page    = NS::Browser.get(url(page)) unless page.is_a?(Typhoeus::Response)
      found   = []

      page.html.xpath(xpath).each do |node|
        attr_value = node.text.to_s

        next unless attr_value && !attr_value.empty?

        node_uri = begin
                     uri.join(attr_value.strip)
                   rescue StandardError
                     # Skip potential malformed URLs etc.
                     next
                   end

        next unless node_uri.host

        yield node_uri, node.parent if block_given? && !found.include?(node_uri)

        found << node_uri
      end

      found.uniq
    end
def uris_from_page(page = nil, xpath = '//@href|//@src|//@data-src')
      page    = NS::Browser.get(url(page)) unless page.is_a?(Typhoeus::Response)
      found   = []

      page.html.xpath(xpath).each do |node|
        attr_value = node.text.to_s

        next unless attr_value && !attr_value.empty?

        node_uri = begin
                     uri.join(attr_value.strip)
                   rescue StandardError
                     # Skip potential malformed URLs etc.
                     next
                   end

        next unless node_uri.host

        yield node_uri, node.parent if block_given? && !found.include?(node_uri)

        found << node_uri
      end

      found.uniq
    end
@param [ Typhoeus::Response, String ] page
 @param [ String ] xpath

 @yield [ Addressable::URI, Nokogiri::XML::Element ] The url and its associated tag

 @return [ Array<Addressable::URI> ] The absolute URIs detected in the response's body from the HTML tags