Ctrl + K
DocumentationLog inGet started

tessl/npm-isbot

tessl install tessl/npm-isbot@5.1.0

Recognise bots/crawlers/spiders using the user agent string.

Agent Success

Agent success rate when using this tile

82%

Improvement

Agent success rate improvement when using this tile compared to baseline

0.94x

Baseline

Agent success rate without this tile

87%

task.mdevals/scenario-3/

Bot Traffic Segmentation

Build a module that classifies user agent strings as bots or humans using the dependency's compiled bot-detection patterns.

Capabilities

Classifies traffic with match evidence

  • Given a typical browser user agent (for example, a recent Chrome UA), the classifier returns an entry with isBot set to false and no match string. @test
  • Given a crawler-style user agent (for example, one containing "Googlebot"), the classifier returns an entry with isBot set to true and a match string that reflects the matched bot identifier from detection. @test

Pattern overrides

  • When an allowlist 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

Compiled pattern export

  • Export a ready-to-use regular expression reflecting the dependency's compiled bot patterns so callers can reuse the exact detection rules. @test

Implementation

@generates

API

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;

Dependencies { .dependencies }

isbot { .dependency }

Detects automated traffic via a compiled regular expression derived from a curated pattern list and exposes that pattern data for customization.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/isbot@5.1.x
tile.json