Sha256: 8ef30eae4984f27d6772c3f3787f0e4fa01519231b9553770dbef583cbfd352e

Contents?: true

Size: 345 Bytes

Versions: 2

Compression:

Stored size: 345 Bytes

Contents

require "webinfo/version"
require "httparty"
require "nokogiri"

class Webinfo
  #addr - site address
  #options - {:node ,:attr}
  def self.get_info(addr, options = {})
    response = HTTParty.get(addr)
    doc = Nokogiri::HTML(response)
    nodes = doc.xpath("//#{options[:node]}")
    nodes.map {|i| i[options[:attr]]}.compact.uniq
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
webinfo-0.1.2 lib/webinfo.rb
webinfo-0.1.1 lib/webinfo.rb