aicrawlers 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.0
4
+
5
+ - **87 AI crawlers** (was 39), including ChatGPT Agent, OAI-AdsBot, Claude-Code, Claude-Agent, Gemini-Deep-Research, Google-NotebookLM, GoogleAgent-Mariner, meta-webindexer, Amzn-SearchBot, Amzn-User, NovaAct, AzureAI-SearchBot, MistralAI-Training, MistralAI-Index, xAI-Grok, GrokBot, TikTokSpider, DoubaoBot, DeepSeekBot, QwenBot, KimiBot, Hunyuan, ERNIEBot, PetalBot, YandexAdditional, Bravebot, ExaBot, TavilyBot and Cloudflare-AutoRAG.
6
+ - **Catch fake bots:** `verifyAiCrawler({ userAgent, ip })` from `aicrawlers/verify` checks the operator's official IP ranges or reverse DNS, and says `verified: true`, `false` or `null` (can't tell), with a reason. CLI: `npx aicrawlers verify <ip> "<user agent>"`.
7
+ - **Blocking rules for more servers:** `apacheRules()` (.htaccess), `caddyRules()`, `cloudflareExpression()` and `cloudflareExpressions()` (split to fit Cloudflare's 4096-character limit), and `nextProxy()` (Next.js `proxy.ts`). CLI: `npx aicrawlers apache | caddy | cloudflare | next`.
8
+ - `allow` option for `isAiCrawler()` and `getAiCrawler()`.
9
+ - `listUpdated`: the date the list was last reviewed.
10
+ - The list is checked every week against the ai.robots.txt list and the operators' IP-range files; changes open an issue for review.
11
+ - README: the full table of supported crawlers, and how to block AI crawlers on each platform.
12
+
3
13
  ## 1.0.0
4
14
 
5
15
  - First release.
package/README.md CHANGED
@@ -1,8 +1,13 @@
1
1
  # aicrawlers
2
2
 
3
- **Know when a request comes from an AI crawler, and block the ones you don't want.**
3
+ **Know when a request comes from an AI crawler, check it's real, and block the ones you don't want.**
4
4
 
5
- A list of 39 AI crawlers (GPTBot, ClaudeBot, PerplexityBot, Bytespider, CCBot…) with who runs each one and what it's for: training AI models, AI search, or fetching a page for a user. Plus `isAiCrawler(userAgent)`, and ready-made robots.txt and nginx rules.
5
+ A list of 87 AI crawlers and agents (GPTBot, ClaudeBot, PerplexityBot, Google-Extended, Bytespider, CCBot, Meta-ExternalAgent, Amazonbot, DeepSeekBot, GrokBot…) with who runs each one and what it's for: training AI models, AI search, or fetching a page for a user.
6
+
7
+ - `isAiCrawler(userAgent)` for your server or middleware
8
+ - `verifyAiCrawler()` to catch fake bots, using the operators' official IP ranges and reverse DNS
9
+ - Ready-made blocking rules for **robots.txt, nginx, Apache (.htaccess), Caddy, Cloudflare and Next.js**
10
+ - Checked every week against operators' documentation and the community [ai.robots.txt](https://github.com/ai-robots-txt/ai.robots.txt) list
6
11
 
7
12
  Zero dependencies. Works in Node, Bun, Deno, edge runtimes and browsers.
8
13
 
@@ -21,16 +26,16 @@ getAiCrawler("Mozilla/5.0 (compatible; GPTBot/1.2; +https://openai.com/gptbot)")
21
26
 
22
27
  ## Why the purpose matters
23
28
 
24
- Not every AI crawler is the same. Blocking all of them can also remove you from ChatGPT search and Perplexity answers, which send visitors back.
29
+ Not every AI crawler is the same. Blocking all of them also removes you from ChatGPT search, Perplexity and other AI answers that send visitors back.
25
30
 
26
31
  | Purpose | What it does | Examples |
27
32
  |---|---|---|
28
- | `training` | Collects pages to train AI models | GPTBot, ClaudeBot, CCBot, Bytespider, Google-Extended |
29
- | `search` | Powers an AI search or answer product, which can link back to you | OAI-SearchBot, Claude-SearchBot, PerplexityBot, Applebot |
30
- | `user` | Fetches a page because a person asked an assistant about it | ChatGPT-User, Claude-User, Perplexity-User |
33
+ | `training` | Collects pages to train AI models | GPTBot, ClaudeBot, Google-Extended, Applebot-Extended, CCBot, Bytespider, Meta-ExternalAgent, DeepSeekBot |
34
+ | `search` | Powers an AI search or answer product, which can link back to you | OAI-SearchBot, Claude-SearchBot, PerplexityBot, Applebot, Amazonbot |
35
+ | `user` | Fetches a page because a person asked an assistant or agent to | ChatGPT-User, ChatGPT Agent, Claude-User, Perplexity-User, Gemini-Deep-Research |
31
36
  | `other` | Anything else, or not documented | GoogleOther, cohere-ai, FirecrawlAgent |
32
37
 
33
- A common choice is **block training, allow search and user fetches**:
38
+ A common choice is **block AI training, allow AI search and user fetches**:
34
39
 
35
40
  ```js
36
41
  isAiCrawler(userAgent, { purpose: "training" }); // true only for training crawlers
@@ -40,74 +45,54 @@ isAiCrawler(userAgent, { purpose: "training" }); // true only for training crawl
40
45
 
41
46
  | I want to… | Use |
42
47
  |---|---|
43
- | Check a request in my server | `isAiCrawler(userAgent)` |
48
+ | Detect AI bots in my server | `isAiCrawler(userAgent)` |
44
49
  | Know which crawler it is | `getAiCrawler(userAgent)` |
45
- | Block training crawlers only | `isAiCrawler(userAgent, { purpose: "training" })` |
46
- | Write robots.txt rules | `npx aicrawlers robots --block training >> robots.txt` |
47
- | Block on nginx | `npx aicrawlers nginx --block training` |
48
- | Use a regex in a CDN or WAF rule | `aiCrawlerPattern` |
50
+ | Block AI training only | `isAiCrawler(userAgent, { purpose: "training" })` |
51
+ | Catch fake GPTBot / PerplexityBot / Applebot | `verifyAiCrawler({ userAgent, ip })` from `aicrawlers/verify` |
52
+ | Block AI bots in robots.txt | `npx aicrawlers robots >> robots.txt` |
53
+ | Block AI bots on nginx | `npx aicrawlers nginx` |
54
+ | Block AI bots on Apache / .htaccess | `npx aicrawlers apache >> .htaccess` |
55
+ | Block AI bots on Caddy | `npx aicrawlers caddy` |
56
+ | Block AI bots on Cloudflare | `npx aicrawlers cloudflare` |
57
+ | Block AI bots in Next.js | `npx aicrawlers next > proxy.ts` |
49
58
  | See the whole list | `npx aicrawlers list` or `aiCrawlers` |
50
- | Check one user agent from the terminal | `npx aicrawlers check "<user agent>"` |
51
-
52
- ## Examples
53
59
 
54
- ### Express
55
-
56
- ```js
57
- import { isAiCrawler } from "aicrawlers";
60
+ Every rule command takes `--block training,search,user,other` or `--block all` (default: `training`), and `--allow` with crawler names to leave out.
58
61
 
59
- app.use((req, res, next) => {
60
- if (isAiCrawler(req.get("user-agent"), { purpose: "training" })) return res.status(403).end();
61
- next();
62
- });
63
- ```
64
-
65
- ### Next.js middleware
66
-
67
- ```js
68
- import { NextResponse } from "next/server";
69
- import { isAiCrawler } from "aicrawlers";
70
-
71
- export function middleware(request) {
72
- if (isAiCrawler(request.headers.get("user-agent"), { purpose: "training" })) {
73
- return new NextResponse(null, { status: 403 });
74
- }
75
- }
76
- ```
62
+ ## How to block AI crawlers
77
63
 
78
64
  ### robots.txt
79
65
 
80
66
  ```bash
81
- npx aicrawlers robots --block training
67
+ npx aicrawlers robots
82
68
  ```
83
69
 
84
70
  ```
85
- # AI crawler rules, generated by aicrawlers 1.0.0
71
+ # AI crawler rules, generated by aicrawlers 1.1.0
86
72
  # Blocked: training
87
73
  User-agent: GPTBot
88
74
  User-agent: ClaudeBot
89
75
  User-agent: anthropic-ai
90
76
  User-agent: Google-Extended
77
+ User-agent: Applebot-Extended
91
78
  ...
92
79
  Disallow: /
93
80
  ```
94
81
 
95
- The rules include robots.txt-only tokens such as **Google-Extended** and **Applebot-Extended**. They stop Gemini and Apple Intelligence training without removing you from Google Search or Siri.
82
+ The rules include robots.txt-only tokens: **Google-Extended** stops Gemini training without removing you from Google Search, and **Applebot-Extended** stops Apple Intelligence training without removing you from Siri and Spotlight.
96
83
 
97
- Block everything except the AI search bots that send you visitors:
84
+ To block everything except the AI search bots that send you visitors:
98
85
 
99
86
  ```bash
100
87
  npx aicrawlers robots --block all --allow OAI-SearchBot,PerplexityBot,Claude-SearchBot
101
88
  ```
102
89
 
103
- Or from code: `robotsTxt({ block: ["training"], allow: [] })`.
90
+ robots.txt is a request. Well-behaved crawlers follow it, others don't. To enforce it, block on the server too.
104
91
 
105
92
  ### nginx
106
93
 
107
- robots.txt is a request; well-behaved crawlers follow it, others don't. To enforce it, block on the server:
108
-
109
94
  ```bash
110
- npx aicrawlers nginx --block training > /etc/nginx/conf.d/ai-crawlers.conf
95
+ npx aicrawlers nginx > /etc/nginx/conf.d/ai-crawlers.conf
111
96
  ```
112
97
 
113
98
  That defines `$ai_crawler` in the `http` block. Then, in a `server` or `location`:
@@ -116,6 +101,95 @@ That defines `$ai_crawler` in the `http` block. Then, in a `server` or `location
116
101
  if ($ai_crawler) { return 403; }
117
102
  ```
118
103
 
104
+ ### Apache and .htaccess
105
+
106
+ ```bash
107
+ npx aicrawlers apache >> .htaccess
108
+ ```
109
+
110
+ ```apache
111
+ <IfModule mod_rewrite.c>
112
+ RewriteEngine On
113
+ RewriteCond %{HTTP_USER_AGENT} (^|[^a-z0-9])(gptbot|claudebot|ccbot|...)([^a-z0-9]|$) [NC]
114
+ RewriteRule ^ - [F,L]
115
+ </IfModule>
116
+ ```
117
+
118
+ ### Caddy
119
+
120
+ ```bash
121
+ npx aicrawlers caddy
122
+ ```
123
+
124
+ Paste the output inside your site block:
125
+
126
+ ```caddy
127
+ @aicrawlers header_regexp User-Agent "(?i)(^|[^a-z0-9])(gptbot|claudebot|...)([^a-z0-9]|$)"
128
+ respond @aicrawlers 403
129
+ ```
130
+
131
+ ### Cloudflare
132
+
133
+ ```bash
134
+ npx aicrawlers cloudflare
135
+ ```
136
+
137
+ In the Cloudflare dashboard: **Security → WAF → Custom rules → Create rule → Edit expression**. Paste the expression and choose **Block**. It uses `contains`, which works on every plan, including Free. Cloudflare limits an expression to 4096 characters; when the rules are longer (for example with `--block all`), the command prints them as several rules to create.
138
+
139
+ ### Next.js
140
+
141
+ ```bash
142
+ npx aicrawlers next > proxy.ts
143
+ ```
144
+
145
+ ```ts
146
+ import { NextResponse, type NextRequest } from "next/server";
147
+ import { isAiCrawler } from "aicrawlers";
148
+
149
+ export function proxy(request: NextRequest) {
150
+ if (isAiCrawler(request.headers.get("user-agent"), { purpose: ["training"] })) {
151
+ return new NextResponse("Forbidden", { status: 403 });
152
+ }
153
+ return NextResponse.next();
154
+ }
155
+ ```
156
+
157
+ Next.js 16 calls this file `proxy.ts`. For Next.js 15 and earlier, name it `middleware.ts` and the function `middleware`. Because it imports the package, `npm update` brings new crawlers in.
158
+
159
+ ### Express
160
+
161
+ ```js
162
+ import { isAiCrawler } from "aicrawlers";
163
+
164
+ app.use((req, res, next) => {
165
+ if (isAiCrawler(req.get("user-agent"), { purpose: "training" })) return res.status(403).end();
166
+ next();
167
+ });
168
+ ```
169
+
170
+ ## Catch fake AI bots
171
+
172
+ A User-Agent is only a claim, and scrapers often pretend to be GPTBot or PerplexityBot to get past rules. Where an operator publishes how to check (official IP ranges, or reverse-DNS hostnames), `verifyAiCrawler` checks it:
173
+
174
+ ```js
175
+ import { verifyAiCrawler } from "aicrawlers/verify";
176
+
177
+ const v = await verifyAiCrawler({ userAgent: req.get("user-agent"), ip: req.ip });
178
+ // { crawler: { name: "GPTBot", ... }, verified: false, method: "ip-ranges",
179
+ // reason: "203.0.113.9 is not in OpenAI's published ranges for GPTBot" }
180
+
181
+ if (v.crawler && v.verified === false) return res.status(403).end(); // a fake bot
182
+ ```
183
+
184
+ - `verified` is `true` (real), `false` (fake) or `null` (can't tell: the operator publishes no way to check, or the network failed).
185
+ - IP ranges are downloaded once and kept in memory for a day.
186
+ - Reverse DNS uses `node:dns`; on edge runtimes, pass your own `resolver`.
187
+ - `canVerify("GPTBot")` tells you whether a crawler can be checked.
188
+
189
+ From the terminal: `npx aicrawlers verify 20.15.240.64 "GPTBot/1.2"`.
190
+
191
+ [botlens](https://github.com/ckgiri/botlens) runs these checks over your whole server log.
192
+
119
193
  ## API
120
194
 
121
195
  | Export | Returns |
@@ -124,26 +198,150 @@ if ($ai_crawler) { return 403; }
124
198
  | `getAiCrawler(userAgent, options?)` | The crawler (`name`, `operator`, `purpose`, and `ipRanges` or `rdns` when known), or `undefined`. |
125
199
  | `aiCrawlers` | Every known crawler, frozen. |
126
200
  | `aiCrawlerPattern` | A case-insensitive `RegExp` matching any crawler's token. |
127
- | `robotsTxt(options?)` | robots.txt rules as a string. |
201
+ | `listUpdated` | The date the list was last reviewed, e.g. `"2026-12-01"`. |
202
+ | `robotsTxt(options?)` | robots.txt rules. |
128
203
  | `nginxMap(options?)` | An nginx `map` that sets `$ai_crawler`. |
204
+ | `apacheRules(options?)` | Apache mod_rewrite rules for `.htaccess` or the server config. |
205
+ | `caddyRules(options?)` | A Caddyfile matcher and `respond 403`. |
206
+ | `cloudflareExpression(options?)` | A Cloudflare WAF custom-rule expression. |
207
+ | `cloudflareExpressions(options?)` | The same, split into expressions that fit Cloudflare's 4096-character limit. |
208
+ | `nextProxy(options?)` | A Next.js `proxy.ts` file. |
129
209
  | `blockedCrawlers(options?)` | The crawlers a set of rule options blocks. |
130
210
  | `purposes` | `["training", "search", "user", "other"]` |
131
211
 
212
+ From `aicrawlers/verify` (Node, Bun and Deno; edge runtimes with your own `resolver`):
213
+
214
+ | Export | Returns |
215
+ |---|---|
216
+ | `verifyAiCrawler({ userAgent, ip }, options?)` | `{ crawler, verified, method, reason }` |
217
+ | `canVerify(crawlerOrName)` | Whether the crawler publishes IP ranges or reverse-DNS names |
218
+ | `clearVerifyCache()` | Forgets downloaded IP ranges |
219
+
132
220
  Options:
133
- - `isAiCrawler` and `getAiCrawler` take `{ purpose }`: one purpose or a list.
134
- - `robotsTxt`, `nginxMap` and `blockedCrawlers` take `{ block, allow }`:
221
+ - `isAiCrawler` and `getAiCrawler` take `{ purpose, allow }`:
222
+ - `purpose` is one purpose or a list;
223
+ - `allow` lists crawler names never to count.
224
+ - The rule functions take `{ block, allow }`:
135
225
  - `block` is a list of purposes or `"all"`, and defaults to `["training"]`;
136
226
  - `allow` lists crawler names to leave out.
227
+ - `verifyAiCrawler` takes `{ fetch, resolver, cacheTtl, timeout }`.
137
228
 
138
229
  Matching is case-insensitive and on whole tokens: `GPTBot/1.2` matches, `NotGPTBotAtAll` doesn't. It never matches Googlebot, Bingbot, `facebookexternalhit` or browsers, so search engines and link previews keep working.
139
230
 
231
+ ## Supported AI crawlers
232
+
233
+ <!-- crawlers:start -->
234
+ **87 AI crawlers**, list updated 2026-12-01.
235
+
236
+ | User-Agent | Operator | Purpose | Notes |
237
+ |---|---|---|---|
238
+ | YiBot | 01.AI | AI training | |
239
+ | QwenBot | Alibaba | AI training | |
240
+ | TongyiBot | Alibaba | User fetch | |
241
+ | AI2Bot | Allen Institute for AI | AI training | |
242
+ | Ai2Bot-Dolma | Allen Institute for AI | AI training | |
243
+ | Amazonbot | Amazon | AI search | verifiable (reverse DNS) |
244
+ | Amzn-SearchBot | Amazon | AI search | |
245
+ | Amzn-User | Amazon | User fetch | |
246
+ | bedrockbot | Amazon | Other AI | |
247
+ | NovaAct | Amazon | User fetch | |
248
+ | anthropic-ai | Anthropic | AI training | |
249
+ | Claude-Agent | Anthropic | User fetch | |
250
+ | Claude-Code | Anthropic | User fetch | |
251
+ | Claude-SearchBot | Anthropic | AI search | |
252
+ | Claude-User | Anthropic | User fetch | |
253
+ | Claude-Web | Anthropic | Other AI | |
254
+ | ClaudeBot | Anthropic | AI training | |
255
+ | Applebot | Apple | AI search | verifiable (reverse DNS) |
256
+ | Applebot-Extended | Apple | AI training | robots.txt only |
257
+ | ERNIEBot | Baidu | AI training | |
258
+ | YiyanBot | Baidu | User fetch | |
259
+ | Bravebot | Brave | AI search | |
260
+ | Brightbot | Bright Data | Other AI | |
261
+ | Bytespider | ByteDance | AI training | |
262
+ | DoubaoBot | ByteDance | Other AI | |
263
+ | TikTokSpider | ByteDance | AI training | |
264
+ | Cloudflare-AutoRAG | Cloudflare | AI search | |
265
+ | cohere-ai | Cohere | Other AI | |
266
+ | cohere-training-data-crawler | Cohere | AI training | |
267
+ | CCBot | Common Crawl | AI training | |
268
+ | Crawl4AI | Crawl4AI (open source) | Other AI | |
269
+ | DeepSeekBot | DeepSeek | AI training | |
270
+ | Diffbot | Diffbot | AI training | |
271
+ | DuckAssistBot | DuckDuckGo | AI search | |
272
+ | ExaBot | Exa | AI search | |
273
+ | FirecrawlAgent | Firecrawl | Other AI | |
274
+ | Gemini-Deep-Research | Google | User fetch | |
275
+ | Google-Agent | Google | User fetch | |
276
+ | Google-CloudVertexBot | Google | Other AI | verifiable (reverse DNS) |
277
+ | Google-Extended | Google | AI training | robots.txt only |
278
+ | Google-NotebookLM | Google | User fetch | |
279
+ | GoogleAgent-Mariner | Google | User fetch | |
280
+ | GoogleOther | Google | Other AI | verifiable (reverse DNS) |
281
+ | GoogleOther-Image | Google | Other AI | verifiable (reverse DNS) |
282
+ | GoogleOther-Video | Google | Other AI | verifiable (reverse DNS) |
283
+ | ImagesiftBot | Hive | AI training | |
284
+ | PanguBot | Huawei | AI training | |
285
+ | PetalBot | Huawei | AI search | |
286
+ | iaskspider | iAsk.ai | AI search | |
287
+ | img2dataset | img2dataset | AI training | |
288
+ | kagi-fetcher | Kagi | User fetch | |
289
+ | Kangaroo Bot | Kangaroo LLM | AI training | |
290
+ | LAIONDownloader | LAION | AI training | |
291
+ | LinerBot | Liner | Other AI | |
292
+ | Manus-User | Manus | User fetch | |
293
+ | FacebookBot | Meta | AI training | |
294
+ | Meta-ExternalAgent | Meta | AI training | |
295
+ | Meta-ExternalFetcher | Meta | User fetch | |
296
+ | meta-webindexer | Meta | AI search | |
297
+ | AzureAI-SearchBot | Microsoft | AI search | |
298
+ | MistralAI-Index | Mistral | AI search | |
299
+ | MistralAI-Training | Mistral | AI training | |
300
+ | MistralAI-User | Mistral | User fetch | |
301
+ | Kimi-SearchBot | Moonshot AI | AI search | |
302
+ | Kimi-User | Moonshot AI | User fetch | |
303
+ | KimiBot | Moonshot AI | AI training | |
304
+ | MoonshotBot | Moonshot AI | AI training | |
305
+ | ICC-Crawler | NICT (Japan) | AI training | |
306
+ | ChatGPT Agent | OpenAI | User fetch | |
307
+ | ChatGPT-User | OpenAI | User fetch | verifiable (IP ranges) |
308
+ | GPTBot | OpenAI | AI training | verifiable (IP ranges) |
309
+ | OAI-AdsBot | OpenAI | Other AI | |
310
+ | OAI-SearchBot | OpenAI | AI search | verifiable (IP ranges) |
311
+ | Perplexity-User | Perplexity | User fetch | verifiable (IP ranges) |
312
+ | PerplexityBot | Perplexity | AI search | verifiable (IP ranges) |
313
+ | PhindBot | Phind | AI search | |
314
+ | Cotoyogi | ROIS (Japan) | AI training | |
315
+ | SemrushBot-OCOB | Semrush | Other AI | |
316
+ | TavilyBot | Tavily | AI search | |
317
+ | Hunyuan | Tencent | AI training | |
318
+ | Timpibot | Timpi | AI training | |
319
+ | omgili | Webz.io | AI training | |
320
+ | Webzio-Extended | Webz.io | AI training | robots.txt only |
321
+ | GrokBot | xAI | Other AI | |
322
+ | xAI-Grok | xAI | AI training | |
323
+ | YandexAdditional | Yandex | Other AI | |
324
+ | YouBot | You.com | AI search | |
325
+ <!-- crawlers:end -->
326
+
327
+ ## How the list stays current
328
+
329
+ A GitHub Action runs every Monday:
330
+ - It compares the list with the community [ai.robots.txt](https://github.com/ai-robots-txt/ai.robots.txt) list and with the operators' official IP-range files.
331
+ - New names and broken files open an issue for review.
332
+ - Reviewed changes ship as a new version.
333
+
334
+ Names left out on purpose, such as generic tokens like `Spider` or `Scrapy` that would match ordinary tools, are recorded in `scripts/reviewed.json`.
335
+
140
336
  ## FAQ
141
337
 
142
- **Can a scraper fake the User-Agent?** Yes. A User-Agent is only a claim. For crawlers that publish their IP addresses, `ipRanges` (an official JSON list) or `rdns` (reverse-DNS hostnames) tell you how to confirm it. [botlens](https://github.com/ckgiri/botlens) checks this for you against your server logs.
338
+ **How is this different from `isbot`?** `isbot` detects all bots and crawlers. aicrawlers detects only AI crawlers, tells you which one and what it's for, and can check that it's real. So you can block AI training while keeping search engines, link previews and AI search.
339
+
340
+ **Will blocking GPTBot remove me from ChatGPT search?** No. ChatGPT search uses **OAI-SearchBot**, and pages a user asks about are fetched by **ChatGPT-User**. Blocking only `training` keeps both.
143
341
 
144
- **How is this different from `isbot`?** `isbot` detects all bots and crawlers. aicrawlers detects only AI crawlers, and tells you which one and what it's for, so you can block AI training while keeping search engines, link previews and AI search.
342
+ **Does blocking Google-Extended affect Google Search?** No. Google-Extended only controls Gemini training and grounding. Googlebot is separate and never matched.
145
343
 
146
- **A crawler is missing.** Open an issue or a pull request with a link to the operator's documentation of its User-Agent. The list only includes crawlers whose operator documents them.
344
+ **A crawler is missing.** Open an issue or a pull request with a link to its documentation or an example User-Agent.
147
345
 
148
346
  ## Sponsors
149
347
 
@@ -0,0 +1,150 @@
1
+ // src/crawlers.ts
2
+ var GOOGLE_RDNS = ["googlebot.com", "google.com", "googleusercontent.com"];
3
+ var LIST = [
4
+ // OpenAI
5
+ { name: "GPTBot", operator: "OpenAI", purpose: "training", ipRanges: "https://openai.com/gptbot.json" },
6
+ { name: "OAI-SearchBot", operator: "OpenAI", purpose: "search", ipRanges: "https://openai.com/searchbot.json" },
7
+ { name: "ChatGPT-User", operator: "OpenAI", purpose: "user", ipRanges: "https://openai.com/chatgpt-user.json" },
8
+ { name: "ChatGPT Agent", operator: "OpenAI", purpose: "user" },
9
+ { name: "OAI-AdsBot", operator: "OpenAI", purpose: "other" },
10
+ // Anthropic
11
+ { name: "ClaudeBot", operator: "Anthropic", purpose: "training" },
12
+ { name: "Claude-SearchBot", operator: "Anthropic", purpose: "search" },
13
+ { name: "Claude-User", operator: "Anthropic", purpose: "user" },
14
+ { name: "Claude-Web", operator: "Anthropic", purpose: "other" },
15
+ { name: "anthropic-ai", operator: "Anthropic", purpose: "training" },
16
+ { name: "Claude-Code", operator: "Anthropic", purpose: "user" },
17
+ { name: "Claude-Agent", operator: "Anthropic", purpose: "user" },
18
+ // Perplexity
19
+ { name: "PerplexityBot", operator: "Perplexity", purpose: "search", ipRanges: "https://www.perplexity.com/perplexitybot.json" },
20
+ { name: "Perplexity-User", operator: "Perplexity", purpose: "user", ipRanges: "https://www.perplexity.com/perplexity-user.json" },
21
+ // Google
22
+ { name: "Google-Extended", operator: "Google", purpose: "training", robotsOnly: true },
23
+ { name: "Google-CloudVertexBot", operator: "Google", purpose: "other", rdns: GOOGLE_RDNS },
24
+ { name: "GoogleOther", operator: "Google", purpose: "other", rdns: GOOGLE_RDNS },
25
+ { name: "GoogleOther-Image", operator: "Google", purpose: "other", rdns: GOOGLE_RDNS },
26
+ { name: "GoogleOther-Video", operator: "Google", purpose: "other", rdns: GOOGLE_RDNS },
27
+ { name: "Gemini-Deep-Research", operator: "Google", purpose: "user" },
28
+ { name: "Google-NotebookLM", operator: "Google", purpose: "user" },
29
+ { name: "GoogleAgent-Mariner", operator: "Google", purpose: "user" },
30
+ { name: "Google-Agent", operator: "Google", purpose: "user" },
31
+ // Apple
32
+ { name: "Applebot", operator: "Apple", purpose: "search", rdns: ["applebot.apple.com"] },
33
+ { name: "Applebot-Extended", operator: "Apple", purpose: "training", robotsOnly: true },
34
+ // Meta
35
+ { name: "Meta-ExternalAgent", operator: "Meta", purpose: "training" },
36
+ { name: "Meta-ExternalFetcher", operator: "Meta", purpose: "user" },
37
+ { name: "FacebookBot", operator: "Meta", purpose: "training" },
38
+ { name: "meta-webindexer", operator: "Meta", purpose: "search" },
39
+ // Amazon
40
+ { name: "Amazonbot", operator: "Amazon", purpose: "search", rdns: ["crawl.amazonbot.amazon"] },
41
+ { name: "Amzn-SearchBot", operator: "Amazon", purpose: "search" },
42
+ { name: "Amzn-User", operator: "Amazon", purpose: "user" },
43
+ { name: "NovaAct", operator: "Amazon", purpose: "user" },
44
+ { name: "bedrockbot", operator: "Amazon", purpose: "other" },
45
+ // Microsoft
46
+ { name: "AzureAI-SearchBot", operator: "Microsoft", purpose: "search" },
47
+ // Mistral
48
+ { name: "MistralAI-Training", operator: "Mistral", purpose: "training" },
49
+ { name: "MistralAI-Index", operator: "Mistral", purpose: "search" },
50
+ { name: "MistralAI-User", operator: "Mistral", purpose: "user" },
51
+ // xAI
52
+ { name: "xAI-Grok", operator: "xAI", purpose: "training" },
53
+ { name: "GrokBot", operator: "xAI", purpose: "other" },
54
+ // ByteDance
55
+ { name: "Bytespider", operator: "ByteDance", purpose: "training" },
56
+ { name: "TikTokSpider", operator: "ByteDance", purpose: "training" },
57
+ { name: "DoubaoBot", operator: "ByteDance", purpose: "other" },
58
+ // Other AI companies
59
+ { name: "DeepSeekBot", operator: "DeepSeek", purpose: "training" },
60
+ { name: "QwenBot", operator: "Alibaba", purpose: "training" },
61
+ { name: "KimiBot", operator: "Moonshot AI", purpose: "training" },
62
+ { name: "MoonshotBot", operator: "Moonshot AI", purpose: "training" },
63
+ { name: "Kimi-SearchBot", operator: "Moonshot AI", purpose: "search" },
64
+ { name: "Kimi-User", operator: "Moonshot AI", purpose: "user" },
65
+ { name: "TongyiBot", operator: "Alibaba", purpose: "user" },
66
+ { name: "Hunyuan", operator: "Tencent", purpose: "training" },
67
+ { name: "ERNIEBot", operator: "Baidu", purpose: "training" },
68
+ { name: "YiyanBot", operator: "Baidu", purpose: "user" },
69
+ { name: "YiBot", operator: "01.AI", purpose: "training" },
70
+ { name: "CCBot", operator: "Common Crawl", purpose: "training" },
71
+ { name: "DuckAssistBot", operator: "DuckDuckGo", purpose: "search" },
72
+ { name: "cohere-training-data-crawler", operator: "Cohere", purpose: "training" },
73
+ { name: "cohere-ai", operator: "Cohere", purpose: "other" },
74
+ { name: "AI2Bot", operator: "Allen Institute for AI", purpose: "training" },
75
+ { name: "Ai2Bot-Dolma", operator: "Allen Institute for AI", purpose: "training" },
76
+ { name: "PanguBot", operator: "Huawei", purpose: "training" },
77
+ { name: "PetalBot", operator: "Huawei", purpose: "search" },
78
+ { name: "YandexAdditional", operator: "Yandex", purpose: "other", match: ["yandexadditionalbot"] },
79
+ { name: "Bravebot", operator: "Brave", purpose: "search" },
80
+ { name: "kagi-fetcher", operator: "Kagi", purpose: "user" },
81
+ { name: "ExaBot", operator: "Exa", purpose: "search" },
82
+ { name: "TavilyBot", operator: "Tavily", purpose: "search" },
83
+ { name: "LinerBot", operator: "Liner", purpose: "other" },
84
+ { name: "Manus-User", operator: "Manus", purpose: "user" },
85
+ { name: "Diffbot", operator: "Diffbot", purpose: "training" },
86
+ { name: "YouBot", operator: "You.com", purpose: "search" },
87
+ { name: "PhindBot", operator: "Phind", purpose: "search" },
88
+ { name: "iaskspider", operator: "iAsk.ai", purpose: "search" },
89
+ { name: "Timpibot", operator: "Timpi", purpose: "training" },
90
+ { name: "ImagesiftBot", operator: "Hive", purpose: "training" },
91
+ { name: "Kangaroo Bot", operator: "Kangaroo LLM", purpose: "training" },
92
+ { name: "img2dataset", operator: "img2dataset", purpose: "training" },
93
+ { name: "FirecrawlAgent", operator: "Firecrawl", purpose: "other" },
94
+ { name: "Crawl4AI", operator: "Crawl4AI (open source)", purpose: "other" },
95
+ { name: "Brightbot", operator: "Bright Data", purpose: "other" },
96
+ { name: "Cloudflare-AutoRAG", operator: "Cloudflare", purpose: "search" },
97
+ { name: "LAIONDownloader", operator: "LAION", purpose: "training" },
98
+ { name: "SemrushBot-OCOB", operator: "Semrush", purpose: "other" },
99
+ { name: "Cotoyogi", operator: "ROIS (Japan)", purpose: "training" },
100
+ { name: "ICC-Crawler", operator: "NICT (Japan)", purpose: "training" },
101
+ { name: "omgili", operator: "Webz.io", purpose: "training", match: ["omgilibot"] },
102
+ { name: "Webzio-Extended", operator: "Webz.io", purpose: "training", robotsOnly: true }
103
+ ];
104
+ var listUpdated = "2026-12-01";
105
+ var aiCrawlers = Object.freeze(LIST.map((c) => Object.freeze(c)));
106
+ var PURPOSES = ["training", "search", "user", "other"];
107
+ function isPurpose(value) {
108
+ return PURPOSES.includes(value);
109
+ }
110
+
111
+ // src/match.ts
112
+ var version = true ? "1.1.0" : "0.0.0-dev";
113
+ var escapeRegex = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
114
+ var tokensOf = (c) => [c.name.toLowerCase(), ...c.match ?? []];
115
+ var BY_TOKEN = /* @__PURE__ */ new Map();
116
+ for (const c of aiCrawlers) if (!c.robotsOnly) for (const t of tokensOf(c)) BY_TOKEN.set(t, c);
117
+ var ALTERNATION = [...BY_TOKEN.keys()].sort((a, b) => b.length - a.length).map(escapeRegex).join("|");
118
+ var aiCrawlerPattern = new RegExp(`(?<![a-z0-9])(?:${ALTERNATION})(?![a-z0-9])`, "i");
119
+ function purposeFilter(purpose) {
120
+ if (purpose === void 0) return () => true;
121
+ const list = typeof purpose === "string" ? [purpose] : purpose;
122
+ for (const p of list) if (!isPurpose(p)) throw new TypeError(`Unknown purpose "${p}". Use: ${PURPOSES.join(", ")}.`);
123
+ return (c) => list.includes(c.purpose);
124
+ }
125
+ function getAiCrawler(userAgent, options = {}) {
126
+ if (!userAgent) return void 0;
127
+ const found = aiCrawlerPattern.exec(userAgent);
128
+ const crawler = found ? BY_TOKEN.get(found[0].toLowerCase()) : void 0;
129
+ if (!crawler || !purposeFilter(options.purpose)(crawler)) return void 0;
130
+ if (options.allow?.some((n) => n.toLowerCase() === crawler.name.toLowerCase())) return void 0;
131
+ return crawler;
132
+ }
133
+ function isAiCrawler(userAgent, options = {}) {
134
+ return getAiCrawler(userAgent, options) !== void 0;
135
+ }
136
+ var isAiBot = isAiCrawler;
137
+
138
+ export {
139
+ listUpdated,
140
+ aiCrawlers,
141
+ PURPOSES,
142
+ version,
143
+ escapeRegex,
144
+ tokensOf,
145
+ aiCrawlerPattern,
146
+ purposeFilter,
147
+ getAiCrawler,
148
+ isAiCrawler,
149
+ isAiBot
150
+ };