| Class | Sitealizer::Parser::Robot |
| In: |
lib/sitealizer/parser.rb
|
| Parent: | Object |
Process the robots (when available) found on the user agent strings and returns its name:
user_agent = "Googlebot/2.X (+http://www.googlebot.com/bot.html)" Sitealizer::Parser::Robot.get_name(user_agent) => "Googlebot"
# File lib/sitealizer/parser.rb, line 193 def self.get_name(agent) robot = nil if agent =~ /Atomz/i robot = 'Atomz.com' elsif agent =~ /Googlebot/i robot = 'Googlebot' elsif agent =~ /InfoSeek/i robot = 'InfoSeek' elsif agent =~ /Ask Jeeves/i robot = 'Ask Jeeves' elsif agent =~ /Lycos/i robot = 'Lycos' elsif agent =~ /MSNBOT/i robot = 'MSNBot' elsif agent =~ /Slurp/i && agent.scan(/Yahoo/i).empty? robot = 'Inktomi' elsif agent =~ /Yahoo/i robot = 'Yahoo Slurp' end return robot end