@rearguard/is-bot
v1.9.6
Published
Ultra fast bot/crawler detector using user agent strings.
Downloads
612
Maintainers
Readme
@rearguard/is-bot.
Installation.
npm i @rearguard/is-bot
Intro.
@rearguard/is-bot
is a validator for User-Agent strings, it allows efficiently detecting bots, crawlers and scrappers. This library stays up to date with live data provided by https://www.myip.ms
Usage.
const {isBot} = require('@rearguard/is-bot');
isBot(
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36',
); // false
isBot(
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36',
); // => false
isBot(
'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)',
); // => true
Benchmarks.
@rearguard/is-bot
is fast and intuitive, you can find benchmarks against similar libraries in the /bench
folder.
Tests.
yarn test