DamonOehlman / detect-browser

Unpack a browser type and version from the useragent string

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Googlebot not flagged as bot

JackCA opened this issue · comments

If you take the useragent string for the Googlebot smartphone bot:

Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)

The above will be parsed as an android device without any botinfo.

If you change the priority of the rules array and put the Bot regexes as the first item, it works and you'll get bot as the name but you lose the OS and other information.

But I'm wondering if bot detection should actually just be attached to a bot attribute that is attached to all results? Then you would be able to get the OS (android) in this case but also know that it is a bot at the same time

I think this is a good idea...

Some metadata about browsers would be handy with all the evolving IOT devices around

Thoughts @DamonOehlman ?

Yep, I completely agree that it's a good idea. I previously marked the bot flag as deprecated and that people should use the name to test for bot so I think it would be ok to release a new major version where bot returned a string that was useful (Googlebot in this particular case).

PR incoming.

@JackCA resolved in #127, however, I've got a few little tasks to do before I'll release a new major version that will implement support for this improved bot detection.