Sha256: 2ba672542862da50cdf56a13888237e206e238616587c5ac285c224b35856d1f
Contents?: true
Size: 512 Bytes
Versions: 21
Compression:
Stored size: 512 Bytes
Contents
require 'httpclient' require 'nokogiri' module Impressionist module Bots LIST_URL = "http://www.user-agents.org/allagents.xml" def self.consume response = HTTPClient.new.get_content(LIST_URL) doc = Nokogiri::XML(response) list = [] doc.xpath('//user-agent').each do |agent| type = agent.xpath("Type").text list << agent.xpath("String").text.gsub("<","<") if ["R","S"].include?(type) #gsub hack for badly formatted data end list end end end
Version data entries
21 entries across 21 versions & 1 rubygems