@shware/analytics 8.13.1 → 8.15.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.
@@ -0,0 +1,1151 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_bot_generic = require("./generic.cjs");
3
+ //#region src/bot/index.ts
4
+ /**
5
+ * What kind of automated visitor a bot is, as the analytics tools that report bots separately
6
+ * group them (PostHog's traffic categories, Cloudflare's verified bot categories, Matomo's
7
+ * DeviceDetector). Stored next to the name so dashboards can group without re-deriving:
8
+ *
9
+ * - search_crawler: indexes pages for a search engine (Googlebot, Bingbot, Baiduspider)
10
+ * - ai_crawler: collects content to train models (GPTBot, ClaudeBot, Meta-ExternalAgent)
11
+ * - ai_search: indexes pages for an AI search product (OAI-SearchBot, PerplexityBot)
12
+ * - ai_assistant: fetches a page because a person asked an assistant to (ChatGPT-User)
13
+ * - advertising: works for an ad system — reviews landing pages, targets or verifies ads
14
+ * (Meta-ExternalAds, AdsBot-Google, Mediapartners-Google)
15
+ * - link_preview: renders the card of a link shared in a feed or a chat (facebookexternalhit)
16
+ * - seo_tool: SEO, marketing and page-speed tools (AhrefsBot, Lighthouse, HubSpot)
17
+ * - monitoring: uptime checks, synthetics and service callers (Pingdom, Stripe)
18
+ * - headless_browser: a scripted browser (HeadlessChrome, Playwright, a WebDriver session)
19
+ * - http_client: a library or command-line client (curl, python-requests)
20
+ * - no_user_agent: a request without a user agent, which no browser sends
21
+ * - other: automated by every sign, but none of the above
22
+ */
23
+ const BOT_CATEGORIES = [
24
+ "search_crawler",
25
+ "ai_crawler",
26
+ "ai_search",
27
+ "ai_assistant",
28
+ "advertising",
29
+ "link_preview",
30
+ "seo_tool",
31
+ "monitoring",
32
+ "headless_browser",
33
+ "http_client",
34
+ "no_user_agent",
35
+ "other"
36
+ ];
37
+ const NOT_A_BOT = {
38
+ is_bot: false,
39
+ bot_name: null,
40
+ bot_category: null
41
+ };
42
+ /**
43
+ * Bots we can name, as `[name, category, pattern]`, tried in order; the first match wins.
44
+ *
45
+ * Where the list comes from (checked 2026-09-30):
46
+ * - bowser's bot parsers (the ~25 named bots its `platform.type === 'bot'` reports), which this
47
+ * replaces.
48
+ * - PostHog's `bot_definitions.py` (web analytics traffic classification), for the bots and
49
+ * categories an analytics product sees most.
50
+ * - ai.robots.txt (`robots.json`), for AI crawlers, search bots, assistants and agents.
51
+ * - The operators' own docs for the big ones: Google's crawler list, OpenAI's and Anthropic's
52
+ * bot pages, Meta's web crawlers, Perplexity, Bing, Apple.
53
+ * - Bots seen in production (Meta-ExternalAds, HubSpot, Bytespider).
54
+ * Every entry was run against the real user agents in crawler-user-agents and PostHog's
55
+ * fixtures, and bowser's browser fixtures were run to check no browser is taken for a bot
56
+ * (Sogou's browser against its spider, Pinterest's in-app browser against its bot); see
57
+ * `index.test.ts` for where to get them.
58
+ *
59
+ * The link above each entry is the operator's page about the bot, else its product page, else
60
+ * its Known Agents profile (knownagents.com, formerly Dark Visitors) when the operator has none.
61
+ *
62
+ * Names are the operators' spelling of their user agent token. Order matters where one token
63
+ * contains another or borrows a name: advertising and SEO tools come before the search engines
64
+ * whose names they carry, and the more specific of Meta's, Anthropic's and Perplexity's tokens
65
+ * come first. The long tail is left to the generic pattern, filed as `other` and named by
66
+ * `nameOfUnknownBot`; add a bot here when it is worth its own category or name in a dashboard.
67
+ */
68
+ const NAMED_BOTS = [
69
+ [
70
+ "Meta-ExternalAds",
71
+ "advertising",
72
+ /meta-externalads/i
73
+ ],
74
+ [
75
+ "facebookcatalog",
76
+ "advertising",
77
+ /facebookcatalog/i
78
+ ],
79
+ [
80
+ "AdsBot-Google",
81
+ "advertising",
82
+ /adsbot-google/i
83
+ ],
84
+ [
85
+ "Mediapartners-Google",
86
+ "advertising",
87
+ /mediapartners-google/i
88
+ ],
89
+ [
90
+ "AdIdxBot",
91
+ "advertising",
92
+ /adidxbot/i
93
+ ],
94
+ [
95
+ "Google-AdWords",
96
+ "advertising",
97
+ /google-adwords/i
98
+ ],
99
+ [
100
+ "Google-Ads-Conversions",
101
+ "advertising",
102
+ /google-ads-conversions/i
103
+ ],
104
+ [
105
+ "OAI-AdsBot",
106
+ "advertising",
107
+ /oai-adsbot/i
108
+ ],
109
+ [
110
+ "SnapchatAds",
111
+ "advertising",
112
+ /snapchatads/i
113
+ ],
114
+ [
115
+ "Taboolabot",
116
+ "advertising",
117
+ /taboolabot/i
118
+ ],
119
+ [
120
+ "ChatGPT-User",
121
+ "ai_assistant",
122
+ /chatgpt-user/i
123
+ ],
124
+ [
125
+ "Claude-User",
126
+ "ai_assistant",
127
+ /claude-user/i
128
+ ],
129
+ [
130
+ "Claude-Web",
131
+ "ai_assistant",
132
+ /claude-web/i
133
+ ],
134
+ [
135
+ "Perplexity-User",
136
+ "ai_assistant",
137
+ /perplexity-user/i
138
+ ],
139
+ [
140
+ "DuckAssistBot",
141
+ "ai_assistant",
142
+ /duckassistbot/i
143
+ ],
144
+ [
145
+ "Meta-ExternalFetcher",
146
+ "ai_assistant",
147
+ /meta-externalfetcher/i
148
+ ],
149
+ [
150
+ "MistralAI-User",
151
+ "ai_assistant",
152
+ /mistralai-user/i
153
+ ],
154
+ [
155
+ "Manus-User",
156
+ "ai_assistant",
157
+ /manus-user/i
158
+ ],
159
+ [
160
+ "Amzn-User",
161
+ "ai_assistant",
162
+ /amzn-user/i
163
+ ],
164
+ [
165
+ "amazon-QBusiness",
166
+ "ai_assistant",
167
+ /amazon-qbusiness/i
168
+ ],
169
+ [
170
+ "Amazon-Bedrock-AgentCore-Browser",
171
+ "ai_assistant",
172
+ /amazon-bedrock-agentcore/i
173
+ ],
174
+ [
175
+ "Google-Agent",
176
+ "ai_assistant",
177
+ /google-?agent/i
178
+ ],
179
+ [
180
+ "Gemini-Deep-Research",
181
+ "ai_assistant",
182
+ /gemini-deep-research/i
183
+ ],
184
+ [
185
+ "Google-NotebookLM",
186
+ "ai_assistant",
187
+ /google-notebooklm/i
188
+ ],
189
+ [
190
+ "Kimi-User",
191
+ "ai_assistant",
192
+ /kimi-(?:user|agent)/i
193
+ ],
194
+ [
195
+ "TongyiBot",
196
+ "ai_assistant",
197
+ /tongyibot/i
198
+ ],
199
+ [
200
+ "YiyanBot",
201
+ "ai_assistant",
202
+ /yiyanbot/i
203
+ ],
204
+ [
205
+ "kagi-fetcher",
206
+ "ai_assistant",
207
+ /kagi-fetcher/i
208
+ ],
209
+ [
210
+ "Devin",
211
+ "ai_assistant",
212
+ /\bdevin\/\d/i
213
+ ],
214
+ [
215
+ "NovaAct",
216
+ "ai_assistant",
217
+ /novaact/i
218
+ ],
219
+ [
220
+ "OAI-SearchBot",
221
+ "ai_search",
222
+ /oai-searchbot/i
223
+ ],
224
+ [
225
+ "Claude-SearchBot",
226
+ "ai_search",
227
+ /claude-searchbot/i
228
+ ],
229
+ [
230
+ "PerplexityBot",
231
+ "ai_search",
232
+ /perplexitybot/i
233
+ ],
234
+ [
235
+ "Meta-WebIndexer",
236
+ "ai_search",
237
+ /meta-webindexer/i
238
+ ],
239
+ [
240
+ "Amazonbot",
241
+ "ai_search",
242
+ /amazonbot/i
243
+ ],
244
+ [
245
+ "YouBot",
246
+ "ai_search",
247
+ /youbot/i
248
+ ],
249
+ [
250
+ "PhindBot",
251
+ "ai_search",
252
+ /phindbot/i
253
+ ],
254
+ [
255
+ "Amzn-SearchBot",
256
+ "ai_search",
257
+ /amzn-searchbot/i
258
+ ],
259
+ [
260
+ "AzureAI-SearchBot",
261
+ "ai_search",
262
+ /azureai-searchbot/i
263
+ ],
264
+ [
265
+ "Kimi-SearchBot",
266
+ "ai_search",
267
+ /kimi-searchbot/i
268
+ ],
269
+ [
270
+ "MistralAI-Index",
271
+ "ai_search",
272
+ /mistralai-index/i
273
+ ],
274
+ [
275
+ "ExaSearchBot",
276
+ "ai_search",
277
+ /exasearchbot|\bexabot/i
278
+ ],
279
+ [
280
+ "TavilyBot",
281
+ "ai_search",
282
+ /tavilybot/i
283
+ ],
284
+ [
285
+ "LinkupBot",
286
+ "ai_search",
287
+ /linkupbot/i
288
+ ],
289
+ [
290
+ "iAskBot",
291
+ "ai_search",
292
+ /iask(?:bot|spider)/i
293
+ ],
294
+ [
295
+ "Andibot",
296
+ "ai_search",
297
+ /andibot/i
298
+ ],
299
+ [
300
+ "Cloudflare-AutoRAG",
301
+ "ai_search",
302
+ /cloudflare-autorag/i
303
+ ],
304
+ [
305
+ "GPTBot",
306
+ "ai_crawler",
307
+ /gptbot/i
308
+ ],
309
+ [
310
+ "ClaudeBot",
311
+ "ai_crawler",
312
+ /claudebot/i
313
+ ],
314
+ [
315
+ "anthropic-ai",
316
+ "ai_crawler",
317
+ /anthropic-ai/i
318
+ ],
319
+ [
320
+ "Meta-ExternalAgent",
321
+ "ai_crawler",
322
+ /meta-externalagent/i
323
+ ],
324
+ [
325
+ "FacebookBot",
326
+ "ai_crawler",
327
+ /facebookbot/i
328
+ ],
329
+ [
330
+ "Bytespider",
331
+ "ai_crawler",
332
+ /bytespider/i
333
+ ],
334
+ [
335
+ "CCBot",
336
+ "ai_crawler",
337
+ /ccbot/i
338
+ ],
339
+ [
340
+ "Google-CloudVertexBot",
341
+ "ai_crawler",
342
+ /google-cloudvertexbot/i
343
+ ],
344
+ [
345
+ "cohere-ai",
346
+ "ai_crawler",
347
+ /cohere-(?:ai|training-data-crawler)/i
348
+ ],
349
+ [
350
+ "Diffbot",
351
+ "ai_crawler",
352
+ /diffbot/i
353
+ ],
354
+ [
355
+ "Omgili",
356
+ "ai_crawler",
357
+ /omgili|webzio-extended/i
358
+ ],
359
+ [
360
+ "ImagesiftBot",
361
+ "ai_crawler",
362
+ /imagesiftbot/i
363
+ ],
364
+ [
365
+ "Timpibot",
366
+ "ai_crawler",
367
+ /timpibot/i
368
+ ],
369
+ [
370
+ "AI2Bot",
371
+ "ai_crawler",
372
+ /ai2bot/i
373
+ ],
374
+ [
375
+ "PanguBot",
376
+ "ai_crawler",
377
+ /pangubot/i
378
+ ],
379
+ [
380
+ "TikTokSpider",
381
+ "ai_crawler",
382
+ /tiktokspider/i
383
+ ],
384
+ [
385
+ "DeepSeekBot",
386
+ "ai_crawler",
387
+ /deepseekbot/i
388
+ ],
389
+ [
390
+ "DoubaoBot",
391
+ "ai_crawler",
392
+ /doubaobot/i
393
+ ],
394
+ [
395
+ "ERNIEBot",
396
+ "ai_crawler",
397
+ /erniebot/i
398
+ ],
399
+ [
400
+ "QwenBot",
401
+ "ai_crawler",
402
+ /qwenbot/i
403
+ ],
404
+ [
405
+ "KimiBot",
406
+ "ai_crawler",
407
+ /kimibot/i
408
+ ],
409
+ [
410
+ "ChatGLM-Spider",
411
+ "ai_crawler",
412
+ /chatglm-spider/i
413
+ ],
414
+ [
415
+ "MistralAI-Training",
416
+ "ai_crawler",
417
+ /mistralai-training/i
418
+ ],
419
+ [
420
+ "YandexAdditional",
421
+ "ai_crawler",
422
+ /yandexadditional/i
423
+ ],
424
+ [
425
+ "Google-Extended",
426
+ "ai_crawler",
427
+ /google-extended/i
428
+ ],
429
+ [
430
+ "Amazon Kendra",
431
+ "ai_crawler",
432
+ /amazon-kendra|kendrabot/i
433
+ ],
434
+ [
435
+ "bedrockbot",
436
+ "ai_crawler",
437
+ /bedrockbot/i
438
+ ],
439
+ [
440
+ "Brightbot",
441
+ "ai_crawler",
442
+ /brightbot/i
443
+ ],
444
+ [
445
+ "FirecrawlAgent",
446
+ "ai_crawler",
447
+ /firecrawl/i
448
+ ],
449
+ [
450
+ "Crawl4AI",
451
+ "ai_crawler",
452
+ /crawl4ai/i
453
+ ],
454
+ [
455
+ "ApifyBot",
456
+ "ai_crawler",
457
+ /apify/i
458
+ ],
459
+ [
460
+ "img2dataset",
461
+ "ai_crawler",
462
+ /img2dataset/i
463
+ ],
464
+ [
465
+ "LAION",
466
+ "ai_crawler",
467
+ /laion/i
468
+ ],
469
+ [
470
+ "Cloudflare Browser Rendering",
471
+ "ai_crawler",
472
+ /cloudflarebrowserrendering/i
473
+ ],
474
+ [
475
+ "facebookexternalhit",
476
+ "link_preview",
477
+ /facebookexternalhit/i
478
+ ],
479
+ [
480
+ "Facebot",
481
+ "link_preview",
482
+ /facebot/i
483
+ ],
484
+ [
485
+ "Twitterbot",
486
+ "link_preview",
487
+ /twitterbot/i
488
+ ],
489
+ [
490
+ "LinkedInBot",
491
+ "link_preview",
492
+ /linkedinbot/i
493
+ ],
494
+ [
495
+ "Slackbot",
496
+ "link_preview",
497
+ /slackbot|slack-imgproxy/i
498
+ ],
499
+ [
500
+ "Discordbot",
501
+ "link_preview",
502
+ /discordbot/i
503
+ ],
504
+ [
505
+ "TelegramBot",
506
+ "link_preview",
507
+ /telegrambot/i
508
+ ],
509
+ [
510
+ "WhatsApp",
511
+ "link_preview",
512
+ /^whatsapp\//i
513
+ ],
514
+ [
515
+ "Pinterestbot",
516
+ "link_preview",
517
+ /pinterestbot|^pinterest\/0\./i
518
+ ],
519
+ [
520
+ "redditbot",
521
+ "link_preview",
522
+ /redditbot/i
523
+ ],
524
+ [
525
+ "Snap URL Preview",
526
+ "link_preview",
527
+ /snap url preview/i
528
+ ],
529
+ [
530
+ "SkypeUriPreview",
531
+ "link_preview",
532
+ /skypeuripreview/i
533
+ ],
534
+ [
535
+ "BingPreview",
536
+ "link_preview",
537
+ /bingpreview|microsoftpreview/i
538
+ ],
539
+ [
540
+ "Iframely",
541
+ "link_preview",
542
+ /iframely/i
543
+ ],
544
+ [
545
+ "Embedly",
546
+ "link_preview",
547
+ /embedly/i
548
+ ],
549
+ [
550
+ "KakaoTalk-scrap",
551
+ "link_preview",
552
+ /kakaotalk-scrap/i
553
+ ],
554
+ [
555
+ "vkShare",
556
+ "link_preview",
557
+ /vkshare/i
558
+ ],
559
+ [
560
+ "Viber",
561
+ "link_preview",
562
+ /^viber\b|viber-crawler/i
563
+ ],
564
+ [
565
+ "Bluesky Cardyb",
566
+ "link_preview",
567
+ /cardyb/i
568
+ ],
569
+ [
570
+ "Google-PageRenderer",
571
+ "link_preview",
572
+ /google-pagerenderer/i
573
+ ],
574
+ [
575
+ "vercel-screenshot",
576
+ "link_preview",
577
+ /vercel-screenshot/i
578
+ ],
579
+ [
580
+ "Google-InspectionTool",
581
+ "seo_tool",
582
+ /google-inspectiontool/i
583
+ ],
584
+ [
585
+ "Lighthouse",
586
+ "seo_tool",
587
+ /chrome-lighthouse|google page speed insights/i
588
+ ],
589
+ [
590
+ "GTmetrix",
591
+ "seo_tool",
592
+ /gtmetrix/i
593
+ ],
594
+ [
595
+ "AhrefsBot",
596
+ "seo_tool",
597
+ /ahrefs(?:bot|siteaudit)/i
598
+ ],
599
+ [
600
+ "SemrushBot",
601
+ "seo_tool",
602
+ /semrush/i
603
+ ],
604
+ [
605
+ "MJ12bot",
606
+ "seo_tool",
607
+ /mj12bot/i
608
+ ],
609
+ [
610
+ "DotBot",
611
+ "seo_tool",
612
+ /dotbot/i
613
+ ],
614
+ [
615
+ "rogerbot",
616
+ "seo_tool",
617
+ /rogerbot/i
618
+ ],
619
+ [
620
+ "Screaming Frog",
621
+ "seo_tool",
622
+ /screaming frog/i
623
+ ],
624
+ [
625
+ "SerpstatBot",
626
+ "seo_tool",
627
+ /serpstatbot/i
628
+ ],
629
+ [
630
+ "BLEXBot",
631
+ "seo_tool",
632
+ /blexbot/i
633
+ ],
634
+ [
635
+ "DataForSeoBot",
636
+ "seo_tool",
637
+ /dataforseobot/i
638
+ ],
639
+ [
640
+ "HubSpot",
641
+ "seo_tool",
642
+ /hubspot/i
643
+ ],
644
+ [
645
+ "Google-Structured-Data-Testing-Tool",
646
+ "seo_tool",
647
+ /google-structured-data-testing-tool/i
648
+ ],
649
+ [
650
+ "WebPageTest",
651
+ "seo_tool",
652
+ /\bptst\/\d/i
653
+ ],
654
+ [
655
+ "DareBoost",
656
+ "seo_tool",
657
+ /dareboost/i
658
+ ],
659
+ [
660
+ "Barkrowler",
661
+ "seo_tool",
662
+ /barkrowler/i
663
+ ],
664
+ [
665
+ "SE Ranking",
666
+ "seo_tool",
667
+ /seranking|sebot-wa/i
668
+ ],
669
+ [
670
+ "BrightEdge",
671
+ "seo_tool",
672
+ /brightedge/i
673
+ ],
674
+ [
675
+ "SearchAtlas",
676
+ "seo_tool",
677
+ /searchatlas/i
678
+ ],
679
+ [
680
+ "Siteimprove",
681
+ "seo_tool",
682
+ /siteimprove/i
683
+ ],
684
+ [
685
+ "Dataprovider",
686
+ "seo_tool",
687
+ /dataprovider\.com/i
688
+ ],
689
+ [
690
+ "Meltwater",
691
+ "seo_tool",
692
+ /meltwater/i
693
+ ],
694
+ [
695
+ "Awario",
696
+ "seo_tool",
697
+ /awario/i
698
+ ],
699
+ [
700
+ "Googlebot",
701
+ "search_crawler",
702
+ /googlebot/i
703
+ ],
704
+ [
705
+ "Storebot-Google",
706
+ "search_crawler",
707
+ /storebot-google/i
708
+ ],
709
+ [
710
+ "GoogleOther",
711
+ "search_crawler",
712
+ /googleother/i
713
+ ],
714
+ [
715
+ "Bingbot",
716
+ "search_crawler",
717
+ /bingbot/i
718
+ ],
719
+ [
720
+ "Applebot",
721
+ "search_crawler",
722
+ /applebot/i
723
+ ],
724
+ [
725
+ "Baiduspider",
726
+ "search_crawler",
727
+ /baiduspider/i
728
+ ],
729
+ [
730
+ "YandexBot",
731
+ "search_crawler",
732
+ /yandex(?:\w*bot|images|metrika)/i
733
+ ],
734
+ [
735
+ "DuckDuckBot",
736
+ "search_crawler",
737
+ /duckduckbot/i
738
+ ],
739
+ [
740
+ "Yahoo Slurp",
741
+ "search_crawler",
742
+ /yahoo!?[\s/]*slurp/i
743
+ ],
744
+ [
745
+ "Sogou",
746
+ "search_crawler",
747
+ /sogou[\w\s-]*spider/i
748
+ ],
749
+ [
750
+ "360Spider",
751
+ "search_crawler",
752
+ /360spider|haosouspider/i
753
+ ],
754
+ [
755
+ "YisouSpider",
756
+ "search_crawler",
757
+ /yisouspider/i
758
+ ],
759
+ [
760
+ "PetalBot",
761
+ "search_crawler",
762
+ /petalbot/i
763
+ ],
764
+ [
765
+ "SeznamBot",
766
+ "search_crawler",
767
+ /seznambot/i
768
+ ],
769
+ [
770
+ "Yeti",
771
+ "search_crawler",
772
+ /\byeti\//i
773
+ ],
774
+ [
775
+ "Linespider",
776
+ "search_crawler",
777
+ /linespider/i
778
+ ],
779
+ [
780
+ "Qwantbot",
781
+ "search_crawler",
782
+ /qwant(?:bot|ify)/i
783
+ ],
784
+ [
785
+ "coccocbot",
786
+ "search_crawler",
787
+ /coccocbot/i
788
+ ],
789
+ [
790
+ "MojeekBot",
791
+ "search_crawler",
792
+ /mojeekbot/i
793
+ ],
794
+ [
795
+ "Bravebot",
796
+ "search_crawler",
797
+ /bravebot/i
798
+ ],
799
+ [
800
+ "SeekportBot",
801
+ "search_crawler",
802
+ /seekport/i
803
+ ],
804
+ [
805
+ "mwmbl",
806
+ "search_crawler",
807
+ /mwmbl/i
808
+ ],
809
+ [
810
+ "Internet Archive",
811
+ "search_crawler",
812
+ /archive\.org_bot|ia_archiver|archive-it|archiveteam/i
813
+ ],
814
+ [
815
+ "Pingdom",
816
+ "monitoring",
817
+ /pingdom/i
818
+ ],
819
+ [
820
+ "UptimeRobot",
821
+ "monitoring",
822
+ /uptimerobot/i
823
+ ],
824
+ [
825
+ "StatusCake",
826
+ "monitoring",
827
+ /statuscake/i
828
+ ],
829
+ [
830
+ "Site24x7",
831
+ "monitoring",
832
+ /site24x7/i
833
+ ],
834
+ [
835
+ "Better Stack",
836
+ "monitoring",
837
+ /better ?uptime|betterstack/i
838
+ ],
839
+ [
840
+ "Datadog",
841
+ "monitoring",
842
+ /datadog/i
843
+ ],
844
+ [
845
+ "Checkly",
846
+ "monitoring",
847
+ /checkly/i
848
+ ],
849
+ [
850
+ "NewRelicPinger",
851
+ "monitoring",
852
+ /newrelicpinger/i
853
+ ],
854
+ [
855
+ "Uptime-Kuma",
856
+ "monitoring",
857
+ /uptime-kuma/i
858
+ ],
859
+ [
860
+ "Grafana Synthetic Monitoring",
861
+ "monitoring",
862
+ /grafanasyntheticmonitoring/i
863
+ ],
864
+ [
865
+ "Dynatrace",
866
+ "monitoring",
867
+ /ruxitsynthetic|dynatrace/i
868
+ ],
869
+ [
870
+ "Splunk",
871
+ "monitoring",
872
+ /splunk/i
873
+ ],
874
+ [
875
+ "Catchpoint",
876
+ "monitoring",
877
+ /catchpoint/i
878
+ ],
879
+ [
880
+ "Ghost Inspector",
881
+ "monitoring",
882
+ /ghost inspector/i
883
+ ],
884
+ [
885
+ "DigitalOcean Uptime",
886
+ "monitoring",
887
+ /digitalocean uptime/i
888
+ ],
889
+ [
890
+ "OhDear",
891
+ "monitoring",
892
+ /ohdear/i
893
+ ],
894
+ [
895
+ "Google-Safety",
896
+ "monitoring",
897
+ /google-safety/i
898
+ ],
899
+ [
900
+ "Cookiebot",
901
+ "monitoring",
902
+ /cookiebot/i
903
+ ],
904
+ [
905
+ "OneTrust",
906
+ "monitoring",
907
+ /onetrust/i
908
+ ],
909
+ [
910
+ "CookieHub",
911
+ "monitoring",
912
+ /cookiehub/i
913
+ ],
914
+ [
915
+ "Detectify",
916
+ "monitoring",
917
+ /detectify/i
918
+ ],
919
+ [
920
+ "CensysInspect",
921
+ "monitoring",
922
+ /censysinspect/i
923
+ ],
924
+ [
925
+ "BitSightBot",
926
+ "monitoring",
927
+ /bitsightbot/i
928
+ ],
929
+ [
930
+ "zgrab",
931
+ "monitoring",
932
+ /zgrab/i
933
+ ],
934
+ [
935
+ "Nmap",
936
+ "monitoring",
937
+ /nmap scripting engine/i
938
+ ],
939
+ [
940
+ "Stripe",
941
+ "monitoring",
942
+ /stripe\/1\.0|stripebot|merchantsecurityscanner/i
943
+ ],
944
+ [
945
+ "HeadlessChrome",
946
+ "headless_browser",
947
+ /headlesschrome/i
948
+ ],
949
+ [
950
+ "PhantomJS",
951
+ "headless_browser",
952
+ /phantomjs/i
953
+ ],
954
+ [
955
+ "SlimerJS",
956
+ "headless_browser",
957
+ /slimerjs/i
958
+ ],
959
+ [
960
+ "Playwright",
961
+ "headless_browser",
962
+ /playwright/i
963
+ ],
964
+ [
965
+ "Puppeteer",
966
+ "headless_browser",
967
+ /puppeteer/i
968
+ ],
969
+ [
970
+ "Selenium",
971
+ "headless_browser",
972
+ /selenium/i
973
+ ],
974
+ [
975
+ "Cypress",
976
+ "headless_browser",
977
+ /cypress/i
978
+ ],
979
+ [
980
+ "Lightpanda",
981
+ "headless_browser",
982
+ /lightpanda/i
983
+ ],
984
+ [
985
+ "wkhtmltopdf",
986
+ "headless_browser",
987
+ /wkhtmltopdf/i
988
+ ],
989
+ [
990
+ "curl",
991
+ "http_client",
992
+ /^curl\//i
993
+ ],
994
+ [
995
+ "Wget",
996
+ "http_client",
997
+ /^wget\//i
998
+ ],
999
+ [
1000
+ "python-requests",
1001
+ "http_client",
1002
+ /python-requests/i
1003
+ ],
1004
+ [
1005
+ "python-urllib",
1006
+ "http_client",
1007
+ /python-urllib/i
1008
+ ],
1009
+ [
1010
+ "aiohttp",
1011
+ "http_client",
1012
+ /aiohttp/i
1013
+ ],
1014
+ [
1015
+ "httpx",
1016
+ "http_client",
1017
+ /python-httpx|^httpx\//i
1018
+ ],
1019
+ [
1020
+ "Scrapy",
1021
+ "http_client",
1022
+ /scrapy/i
1023
+ ],
1024
+ [
1025
+ "Go-http-client",
1026
+ "http_client",
1027
+ /go-http-client/i
1028
+ ],
1029
+ [
1030
+ "okhttp",
1031
+ "http_client",
1032
+ /^okhttp\//i
1033
+ ],
1034
+ [
1035
+ "Java",
1036
+ "http_client",
1037
+ /^java\/|apache-httpclient/i
1038
+ ],
1039
+ [
1040
+ "axios",
1041
+ "http_client",
1042
+ /^axios\//i
1043
+ ],
1044
+ [
1045
+ "node-fetch",
1046
+ "http_client",
1047
+ /node-fetch/i
1048
+ ],
1049
+ [
1050
+ "undici",
1051
+ "http_client",
1052
+ /^undici/i
1053
+ ],
1054
+ [
1055
+ "PostmanRuntime",
1056
+ "http_client",
1057
+ /postmanruntime/i
1058
+ ],
1059
+ [
1060
+ "insomnia",
1061
+ "http_client",
1062
+ /^insomnia\//i
1063
+ ],
1064
+ [
1065
+ "libwww-perl",
1066
+ "http_client",
1067
+ /libwww-perl/i
1068
+ ],
1069
+ [
1070
+ "Guzzle",
1071
+ "http_client",
1072
+ /guzzlehttp/i
1073
+ ],
1074
+ [
1075
+ "Google-Apps-Script",
1076
+ "http_client",
1077
+ /google-apps-script/i
1078
+ ],
1079
+ [
1080
+ "GoogleDocs",
1081
+ "http_client",
1082
+ /googledocs/i
1083
+ ]
1084
+ ];
1085
+ const botishToken = /\b([\w.-]*?(?:bot|crawler|spider|scraper|fetcher|agent|preview|checker|monitor)[\w-]*)\b/i;
1086
+ const botishWord = /^(?:bot|crawler|spider|scraper|fetcher|agent|preview|checker|monitor)$/i;
1087
+ const compatibleToken = /compatible;\s*([a-z][\w.-]*(?: [a-z][\w.-]*)?)/i;
1088
+ const productTokens = /([a-z][\w.-]*)\/\d/gi;
1089
+ const browserToken = /^(?:mozilla|applewebkit|khtml|gecko|chrome|chromium|safari|version|mobile|firefox|edg|edge|opr|msie|trident)$/i;
1090
+ /**
1091
+ * A name for a bot that is not in the named table, from the first of: a token that sounds like
1092
+ * one (`Bytespider`, `ABEvalBot`), the name after `compatible;` (`Google-Read-Aloud`), a product
1093
+ * token that is not a browser's (`Barkrowler/0.5`), what the generic pattern matched. URLs and
1094
+ * email addresses are dropped first, as nearly every crawler links its docs.
1095
+ */
1096
+ function nameOfUnknownBot(userAgent, matched) {
1097
+ const text = userAgent.replace(/\+?https?:\/\/\S+/gi, " ").replace(/[\w.+-]+@[\w-]+(?:\.[\w-]+)+/g, " ");
1098
+ const botish = botishToken.exec(text)?.[1];
1099
+ if (botish && !botishWord.test(botish)) return botish.slice(0, 64);
1100
+ const compatible = compatibleToken.exec(text)?.[1];
1101
+ if (compatible && !browserToken.test(compatible)) return compatible.slice(0, 64);
1102
+ for (const [, product] of text.matchAll(productTokens)) if (!browserToken.test(product)) return product.slice(0, 64);
1103
+ return matched.replace(/^\W+|\W+$/g, "").slice(0, 64) || "unknown";
1104
+ }
1105
+ /**
1106
+ * Whether a web visitor is a bot, which one, and what kind. Run on the server when the visitor
1107
+ * is created, with the tags it was created with: the user agent is the request's header
1108
+ * (`tags.user_agent`, which the server writes), not anything the client says about itself, so
1109
+ * the verdict can be recomputed from stored tags when the rules change.
1110
+ *
1111
+ * Call it for web visitors only: a native app's requests carry an HTTP library's user agent
1112
+ * (CFNetwork, okhttp) that would read as a bot, and no crawler runs the app.
1113
+ *
1114
+ * In order: a bot we can name; a browser driven by WebDriver (`tags.webdriver`, which the SDK
1115
+ * sets from `navigator.webdriver`, the one sign a scripted browser with a normal user agent
1116
+ * gives); anything the generic pattern calls automated; no user agent at all.
1117
+ */
1118
+ function botOf(tags) {
1119
+ const userAgent = typeof tags.user_agent === "string" ? tags.user_agent.trim() : "";
1120
+ for (const [name, category, pattern] of NAMED_BOTS) if (pattern.test(userAgent)) return {
1121
+ is_bot: true,
1122
+ bot_name: name,
1123
+ bot_category: category
1124
+ };
1125
+ const generic = userAgent ? require_bot_generic.GENERIC_BOT.exec(userAgent) : null;
1126
+ const unknownName = generic ? nameOfUnknownBot(userAgent, generic[0]) : null;
1127
+ if (tags.webdriver === true) return {
1128
+ is_bot: true,
1129
+ bot_name: unknownName ?? "WebDriver",
1130
+ bot_category: "headless_browser"
1131
+ };
1132
+ if (unknownName) return {
1133
+ is_bot: true,
1134
+ bot_name: unknownName,
1135
+ bot_category: "other"
1136
+ };
1137
+ if (!userAgent) return {
1138
+ is_bot: true,
1139
+ bot_name: "(no user agent)",
1140
+ bot_category: "no_user_agent"
1141
+ };
1142
+ return NOT_A_BOT;
1143
+ }
1144
+ //#endregion
1145
+ exports.BOT_CATEGORIES = BOT_CATEGORIES;
1146
+ exports.NAMED_BOTS = NAMED_BOTS;
1147
+ exports.NOT_A_BOT = NOT_A_BOT;
1148
+ exports.botOf = botOf;
1149
+ exports.nameOfUnknownBot = nameOfUnknownBot;
1150
+
1151
+ //# sourceMappingURL=index.cjs.map