-
-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathgenerated-bot-matcher.ts
More file actions
22 lines (20 loc) · 1.76 KB
/
Copy pathgenerated-bot-matcher.ts
File metadata and controls
22 lines (20 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Generated by build.config.ts. Do not edit.
const defaultBotPattern = /(?=(googlebot)|(google\.com\/bot\.html)|(bingbot)|(msnbot)|(yandexbot)|(baiduspider)|(baidu\.com)|(duckduckbot)|(duckduckgo\.com)|(slurp)|(applebot)|(twitterbot)|(twitter)|(facebookexternalhit)|(facebook\.com)|(linkedinbot)|(linkedin)|(pinterestbot)|(pinterest)|(discordbot)|(discordapp)|(mj12bot)|(majestic12\.co\.uk\/bot)|(ahrefsbot)|(ahrefs\.com)|(semrushbot)|(semrush\.com\/bot)|(screaming frog)|(screamingfrog\.co\.uk)|(rogerbot)|(anthropic)|(claude)|(gptbot)|(openai\.com)|(google-extended)|(bytespider)|(diffbot)|(cohere)|(ccbot)|(commoncrawl\.org)|(perplexitybot)|(perplexity\.ai)|(bot)|(spider)|(crawler)|(scraper)|(phantomjs)|(headless)|(playwright)|(selenium)|(webdriver)|(puppeteer)|(python-requests)|(python)|(wget)|(curl)|(zgrab)|(masscan)|(nmap)|(insecure\.org)|(nikto)|(wpscan)|(scrapy))/g
const botTargets: number[] = [0, 0, 1, 1, 2, 3, 3, 4, 4, 5, 6, 256, 256, 257, 257, 258, 258, 259, 259, 260, 260, 512, 512, 513, 513, 514, 514, 515, 515, 516, 768, 769, 770, 770, 771, 773, 774, 776, 777, 777, 778, 778, 1024, 1025, 1026, 1027, 1280, 1284, 1282, 1283, 1283, 1284, 1536, 1536, 1537, 1538, 1792, 1793, 1794, 1794, 1795, 1796, 2048]
export function matchDefaultBotTarget(value: string): number | undefined {
let bestPriority = -1
defaultBotPattern.lastIndex = 0
let match = defaultBotPattern.exec(value)
while (match) {
let priority = 0
while (typeof match[priority + 1] === 'undefined')
priority++
if (bestPriority === -1 || priority < bestPriority)
bestPriority = priority
if (bestPriority === 0)
break
defaultBotPattern.lastIndex = match.index + 1
match = defaultBotPattern.exec(value)
}
return bestPriority === -1 ? undefined : botTargets[bestPriority]
}