Buckets:
| import { HTML_LIMITED_BOT_UA_RE } from './html-bots' | |
| // Bot crawler that will spin up a headless browser and execute JS. | |
| // Only the main Googlebot search crawler executes JavaScript, not other Google crawlers. | |
| // x-ref: https://developers.google.com/search/docs/crawling-indexing/google-common-crawlers | |
| // This regex specifically matches "Googlebot" but NOT "Mediapartners-Google", "AdsBot-Google", etc. | |
| const HEADLESS_BROWSER_BOT_UA_RE = /Googlebot(?!-)|Googlebot$/i | |
| export const HTML_LIMITED_BOT_UA_RE_STRING = HTML_LIMITED_BOT_UA_RE.source | |
| export { HTML_LIMITED_BOT_UA_RE } | |
| function isDomBotUA(userAgent: string) { | |
| return HEADLESS_BROWSER_BOT_UA_RE.test(userAgent) | |
| } | |
| function isHtmlLimitedBotUA(userAgent: string) { | |
| return HTML_LIMITED_BOT_UA_RE.test(userAgent) | |
| } | |
| export function isBot(userAgent: string): boolean { | |
| return isDomBotUA(userAgent) || isHtmlLimitedBotUA(userAgent) | |
| } | |
| export function getBotType(userAgent: string): 'dom' | 'html' | undefined { | |
| if (isDomBotUA(userAgent)) { | |
| return 'dom' | |
| } | |
| if (isHtmlLimitedBotUA(userAgent)) { | |
| return 'html' | |
| } | |
| return undefined | |
| } | |
Xet Storage Details
- Size:
- 1.11 kB
- Xet hash:
- bd77658c8346dde00ffb3ea89abbfd2d404ac9a9d1ea26d8b7d55005063840ff
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.