Recognise bots/crawlers/spiders using the user agent string.
82
Build a module that classifies user agent strings as bots or humans using the dependency's compiled bot-detection patterns.
isBot set to false and no match string. @testisBot set to true and a match string that reflects the matched bot identifier from detection. @testallowlist includes a token such as "Lighthouse" and the input contains that token, the entry is reported as human even though the base bot pattern would match; the override should be applied by adjusting the dependency's curated pattern list before detection. @test@generates
export interface Classification {
userAgent: string;
isBot: boolean;
match?: string;
}
export interface ClassificationOptions {
allowlist?: string[];
}
export function classifyUserAgents(
userAgents: string[],
options?: ClassificationOptions
): Classification[];
export const compiledBotPattern: RegExp;Detects automated traffic via a compiled regular expression derived from a curated pattern list and exposes that pattern data for customization.
Install with Tessl CLI
npx tessl i tessl/npm-isbot