AI 爬虫的用户代理和 IP 范围:GPTBot、ClaudeBot、PerplexityBot 等
GPTBot 使用包含 GPTBot/1.4; +https://openai.com/gptbot 的用户代理表明身份;OpenAI、Anthropic、Perplexity、Google、Microsoft、Apple 和 Common Crawl 都各自公布了一份 JSON 列表,列出其爬虫使用的 IP 范围。只有两者都匹配,请求才是真实的:用户代理点名了该爬虫,并且来源 IP 在该厂商的列表中;对于 Googlebot、bingbot、Applebot 和 CCBot,也可以通过反向和正向 DNS 检查。单凭用户代理什么也证明不了,因为任何人都可以发送它。
当你在日志中看到 GPTBot 或 ClaudeBot,或者想写一条放行 AI 搜索爬虫的防火墙规则时,你需要两样东西:每个爬虫发送的确切字符串,以及证明请求确实来自其所称公司的方法。下面列出各厂商目前公布的字符串、各自的官方 IP 列表或 DNS 验证方法,以及两个可用于检查地址的脚本。
本页内容
GPTBot、ClaudeBot、PerplexityBot 等 AI 爬虫的用户代理字符串是什么?
以下内容摘自各厂商自己的文档。OpenAI 和 Perplexity 指出版本号可能变化,Google 和 Microsoft 会在 W.X.Y.Z 处填入当前浏览器版本,Apple 表示会不时更新浏览器部分。请匹配爬虫标识,例如 GPTBot 或 bingbot,而不是整个字符串。
# OpenAI (version numbers may change)
GPTBot: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; GPTBot/1.4; +https://openai.com/gptbot
OAI-SearchBot: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36; compatible; OAI-SearchBot/1.4; +https://openai.com/searchbot
ChatGPT-User: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; ChatGPT-User/1.0; +https://openai.com/bot
OAI-AdsBot: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; OAI-AdsBot/1.0; +https://openai.com/adsbot
# Perplexity
PerplexityBot: Mozilla/5.0 (compatible; PerplexityBot/1.0; +https://perplexity.ai/perplexitybot)
Perplexity-User: Mozilla/5.0 (compatible; Perplexity-User/1.0; +https://perplexity.ai/perplexity-user)
# Google (W.X.Y.Z is the current Chrome version)
Googlebot Smartphone: Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/W.X.Y.Z Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
Googlebot Desktop: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Googlebot/2.1; +http://www.google.com/bot.html) Chrome/W.X.Y.Z Safari/537.36
Googlebot Desktop: Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
# Microsoft Bing (W.X.Y.Z is the current Edge version)
bingbot desktop: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm) Chrome/W.X.Y.Z Safari/537.36
bingbot: Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)
bingbot mobile: Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/W.X.Y.Z Mobile Safari/537.36 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)
# Apple (the browser part changes from time to time)
Applebot desktop: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4 Safari/605.1.15 (Applebot/0.1; +http://www.apple.com/go/applebot)
Applebot mobile: Mozilla/5.0 (iPhone; CPU iPhone OS 17_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Mobile/15E148 Safari/604.1 (Applebot/0.1; +http://www.apple.com/go/applebot)
# Common Crawl
CCBot: CCBot/2.0 (https://commoncrawl.org/faq/)
# Anthropic and Meta: match the token, see the notes below
ClaudeBot, Claude-SearchBot, Claude-User
meta-externalagent/1.1, meta-webindexer/1.1, meta-externalfetcher/1.1 Anthropic 的帮助文章点名了 ClaudeBot、Claude-SearchBot 和 Claude-User,但没有给出完整的用户代理字符串,所以请匹配这些标识。Meta 的爬虫页面列出的字符串以所示标识开头,后面跟着指向其文档的链接,并表示你日志中显示的字符串可能略有不同。
哪个爬虫做什么?哪些名称只是 robots.txt 标识?
GPTBot收集可能用于训练 OpenAI 基础模型的内容。OAI-SearchBot让网站出现在 ChatGPT 搜索中。ChatGPT-User为用户发起的操作抓取页面,OpenAI 表示 robots.txt 规则可能不适用于它。OAI-AdsBot检查作为 ChatGPT 广告提交的页面。ClaudeBot为 Anthropic 的模型收集数据,Claude-SearchBot用于改进搜索结果,Claude-User在有人向 Claude 提问时抓取页面。PerplexityBot在 Perplexity 搜索中展示并链接网站,不用于训练基础模型。Perplexity-User在用户提问时抓取页面。meta-externalagent为训练 AI 模型或为内容建立索引而抓取,meta-webindexer为 Meta AI 搜索建立内容索引,meta-externalfetcher应用户请求抓取链接。CCBot是公共网络档案库 Common Crawl 的爬虫。
有两个名称永远不会出现在你的日志中。Google-Extended 是一个 robots.txt 标识,用于控制 Google 抓取的内容能否用于 Gemini 模型和 grounding;Google 表示它不影响网页能否被收录到 Google 搜索中。用 Apple 的话说,Applebot-Extended 是一个不抓取网页的次级用户代理;它只决定 Apple 可以如何使用 Applebot 收集的数据。自称是这两者之一的请求都不是真的。
AI 爬虫厂商在哪里公布它们的 IP 范围?
大多数厂商都会公布一个格式相同的 JSON 文件:一个由包含 ipv4Prefix 或 ipv6Prefix 的对象组成的 prefixes 数组,以及一个表明文件新旧的 creationTime。
- OpenAI:
https://openai.com/gptbot.json、https://openai.com/searchbot.json、https://openai.com/chatgpt-user.json和https://openai.com/adsbot.json,每个代理一个。 - Anthropic:
https://claude.com/crawling/bots.json,其所有爬虫共用一个列表。Anthropic 表示,地址在此列表中即表明爬虫来自 Anthropic,同时也表示屏蔽 IP 未必能可靠地实现退出。 - Perplexity:
https://www.perplexity.ai/perplexitybot.json和https://www.perplexity.ai/perplexity-user.json。 - Google:Googlebot 使用
https://developers.google.com/static/crawling/ipranges/common-crawlers.json,特殊用途爬虫和用户触发的抓取工具另有单独的文件。也可以使用反向 DNS。 - Apple:
https://search.developer.apple.com/applebot.json,或applebot.apple.com中的反向 DNS。 - Common Crawl:
https://index.commoncrawl.org/ccbot.json。对于 IPv4,它还建议在crawl.commoncrawl.org下进行正向确认的反向 DNS 检查;IPv6 地址没有反向 DNS。 - Microsoft:
https://www.bing.com/toolbox/bingbot.json,Bing 要求你每天刷新,因为它随时可能变化;或使用以search.msn.com结尾的反向 DNS。Bing 还提供公开的 Verify Bingbot 工具。 - Meta:其爬虫页面没有公布 IP 列表。
如何对照官方爬虫列表检查 IP 地址?
这个脚本会加载每个列表,并报告哪个列表包含该地址。它只需要 Python 3,支持 IPv4 和 IPv6。
python3 - 20.171.206.5 <<'EOF'
import ipaddress, json, sys, urllib.request
LISTS = {
"GPTBot": "https://openai.com/gptbot.json",
"OAI-SearchBot": "https://openai.com/searchbot.json",
"ChatGPT-User": "https://openai.com/chatgpt-user.json",
"ClaudeBot, Claude-SearchBot, Claude-User": "https://claude.com/crawling/bots.json",
"PerplexityBot": "https://www.perplexity.ai/perplexitybot.json",
"Perplexity-User": "https://www.perplexity.ai/perplexity-user.json",
"Googlebot": "https://developers.google.com/static/crawling/ipranges/common-crawlers.json",
"bingbot": "https://www.bing.com/toolbox/bingbot.json",
"Applebot": "https://search.developer.apple.com/applebot.json",
"CCBot": "https://index.commoncrawl.org/ccbot.json",
}
ip = ipaddress.ip_address(sys.argv[1])
found = False
for name, url in LISTS.items():
req = urllib.request.Request(url, headers={"User-Agent": "ip-list-check"})
try:
prefixes = json.load(urllib.request.urlopen(req, timeout=15))["prefixes"]
except Exception as err:
print(f"{name}: list not loaded ({err})")
continue
nets = [ipaddress.ip_network(p.get("ipv4Prefix") or p.get("ipv6Prefix")) for p in prefixes]
if any(ip in net for net in nets if net.version == ip.version):
print(f"{ip} is listed for {name}")
found = True
if not found:
print(f"{ip} is not in any of these lists")
EOF 这些列表会变化。每个文件都带有自己的 creationTime,Perplexity 建议自动更新防火墙规则,Bing 要求每天刷新其列表。如果你在防火墙中使用这些列表,请定期获取,而不是只复制一次。
如何用反向 DNS 验证 Googlebot、bingbot 或 Applebot?
Google、Microsoft、Apple 和 Common Crawl 都记录了同样的两步检查:查询 IP 地址对应的名称,确认它以厂商的域名结尾,然后查询这个名称,确认它返回同一个 IP。两步都很重要,因为控制某个 IP 范围的人可以随意设置反向 DNS 名称,却无法让厂商的域名指回该 IP。
verify_crawler_ip() {
ip="$1"
name=$(host "$ip" | awk '/domain name pointer/ {print $NF}' | sed 's/\.$//' | head -n 1)
if [ -z "$name" ]; then echo "$ip: no reverse DNS name"; return 1; fi
case "$name" in
*.googlebot.com|*.search.msn.com|*.applebot.apple.com|*.crawl.commoncrawl.org) ;;
*) echo "$ip -> $name: not a crawler hostname"; return 1 ;;
esac
if host "$name" | grep -qwF -- "$ip"; then
echo "$ip -> $name -> $ip: verified"
else
echo "$ip -> $name: forward lookup does not return $ip"; return 1
fi
}
verify_crawler_ip 66.249.66.1
# 66.249.66.1 -> crawl-66-249-66-1.googlebot.com -> 66.249.66.1: verified Google 在各类爬虫中接受 googlebot.com、google.com 和 googleusercontent.com;上面的函数只接受 googlebot.com,这正是 Google 示例中 Googlebot 本身使用的域名。对于 Google 的其他爬虫和抓取工具,请使用其 JSON 列表。DNS 查询需要时间,所以请在查看日志时运行或缓存结果,而不要在每个实时请求上运行。
为什么只检查用户代理不足以识别 GPTBot?
用户代理是由客户端自行选择的请求头,所以任何人都可以发送 GPTBot 或 Googlebot。Common Crawl 警告说,有些爬虫冒充 CCBot;Bing 也发布了一份指南,教你检查自称 bingbot 的流量是否真的来自 Bing。要可靠地识别 GPTBot,就必须两者都检查:用户代理中的标识,以及来源 IP 是否在 gptbot.json 中。带有该标识却来自未列出地址的请求是冒充者,屏蔽它不会影响 OpenAI。
反过来的情况也会发生。如果你的防火墙只按用户代理放行,冒充者就能进来;如果只按 IP 范围放行,来自该厂商网络的任何代理都会得到同样的对待,包括你本想屏蔽的那个。两者同时匹配才是可靠的规则。
AISeeWhy 如何帮助验证 AI 爬虫流量?
免费的 AISeeWhy AI 爬虫 IP 检查无需账户,即可告诉你某个 IP 地址是否属于 GPTBot 或其他 AI 爬虫。免费的网站检测则以 16 个 AI 和搜索爬虫的身份并结合真实浏览器请求你的页面,让你看到真正的爬虫会收到什么。
下一步
本文涉及的爬虫
常见问题
GPTBot 的用户代理是什么?
OpenAI 公布的是 Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; GPTBot/1.4; +https://openai.com/gptbot,并指出版本可能会变化。请匹配 GPTBot,并对照 https://openai.com/gptbot.json 确认 IP。
OAI-SearchBot 的用户代理是什么?
一个类似 Chrome 的字符串,以 compatible; OAI-SearchBot/1.4; +https://openai.com/searchbot 结尾。其地址列在 https://openai.com/searchbot.json 中。OpenAI 用它让网站出现在 ChatGPT 搜索中,这与 GPTBot 的工作不同。
Anthropic 公布 ClaudeBot 的 IP 地址吗?
公布。Anthropic 提供了 https://claude.com/crawling/bots.json 的链接,并表示来源 IP 在该列表中即表明爬虫来自 Anthropic。其帮助文章点名了各机器人标识,但没有给出完整的用户代理字符串。
我能在日志中看到 Google-Extended 或 Applebot-Extended 吗?
不能。两者都是 robots.txt 标识,而不是爬虫。Google 和 Apple 使用 Googlebot 和 Applebot 抓取页面,这些标识只用于决定内容可以如何用于 AI。
bingbot 的 IP 地址列表在哪里?
Bing 将其发布在 https://www.bing.com/toolbox/bingbot.json,并要求你每天刷新。它自己的指南推荐使用反向和正向 DNS 检查,其中名称必须以 search.msn.com 结尾。
参考资料
- OpenAI: Overview of OpenAI crawlers
- Anthropic: Does Anthropic crawl the web? What is Claude Bot?
- Perplexity: Perplexity crawlers
- Google: Google's common crawlers
- Google: Verifying Googlebot and other Google crawlers
- Bing Webmaster Tools: Which crawlers does Bing use?
- Bing Webmaster Tools: How to verify Bingbot
- Microsoft Bing: Verify Bingbot tool
- Apple: About Applebot
- Meta: Meta web crawlers
- Common Crawl: CCBot