Detect bots/crawlers/spiders using the user agent string.
Check it out
const isbot = ;
// Nodejs HTTP// ExpressJS// User Agent string// true// false
Add crawler user agents
Add rules to user agent match RegExp
// falseisbot// true
Remove matches of known crawlers
Remove rules to user agent match RegExp (see existing rules in
// trueisbot// false
Return the respective match for bot user agent rule
isbot // 'bot'
- Bot. Autonomous program imitating or replacing some aspect of a human behaviour, performing repetitive tasks much faster than human users could.
- Good bot. Automated programs who visit websites in order to collect useful information. Web crawlers, site scrapers, stress testers, preview builders and other programs are welcomed on most websites because they serve purposes of mutual benefits.
- Bad bot. Programs which are designed to perform malicious actions, ultimately hurting businesses. Testing credential databases, DDoS attacks, spam bots.
What does "isbot" do?
This package aims to identify "Good bots". Those who voluntarily identify themselves by setting a unique, preferably descriptive, user agent, usually by setting a dedicated request header.
What doesn't "isbot" do?
It does not try to recognise malicious bots or programs disguising themselves as real users.
Why would I want to identify good bots?
Recognising good bots such as web crawlers is useful for multiple purposes. Although it is not recommended to serve different content to web crawlers like Googlebot, you can still elect to
- Flag bot pageviews to consider in business analysis
- Prefer to serve cached content and relieve service load
- Omit third party solutions' code (tags, pixels)
It is not recommended to whitelist requests for any reason based on user agent header only. Instead other methods of identification can be added such as reverse dns lookup.