module Impressionist::Bots

Constants

LIST_URL

Public Class Methods

consume() click to toggle source
# File lib/impressionist/bots.rb, line 8
def self.consume
  Timeout.timeout(4) do
    response = Net::HTTP.get(URI.parse(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("&lt;","<") if ["R","S"].include?(type) #gsub hack for badly formatted data
    end
    list
  end
end