今天登上后台的时候瞅了一眼网站日志,发现了这样一系列日志:
20.171.207.72 - - [31/May/2025:18:35:19 +0800] "GET /categories/zhu-yin HTTP/2.0" 200 6056 "-" "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; GPTBot/1.2; +https://openai.com/gptbot)" "-"
20.171.207.72 - - [31/May/2025:18:35:21 +0800] "GET /tags/life HTTP/2.0" 200 5891 "-" "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; GPTBot/1.2; +https://openai.com/gptbot)" "-"
20.171.207.72 - - [31/May/2025:18:35:23 +0800] "GET /tags/otto HTTP/2.0" 200 6234 "-" "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; GPTBot/1.2; +https://openai.com/gptbot)" "-"
20.171.207.72 - - [31/May/2025:18:35:28 +0800] "GET /upload/Written-By-Human-Not-By-AI-Badge-white.png HTTP/2.0" 200 2154 "-" "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; GPTBot/1.2; +https://openai.com/gptbot)" "-"
布豪,是 OpenAI 的爬虫!我寻思这些插件和分类路径有啥好爬的呢…
根据 OpenAI 官方文档,我们有几种方法可以让他们不再抓取我们的博客内容。
robots.txt
OpenAI uses web crawlers (“robots”) and user agents to perform actions for its products, either automatically or triggered by user request. OpenAI uses the following robots.txt tags to enable webmasters to manage how their sites and content work with AI. Each setting is independent of the others – for example, a webmaster can allow OAI-SearchBot to appear in search results while disallowing GPTbot to indicate that crawled content should not be used for training OpenAI’s generative AI foundation models. For search results, please note it can take ~24 hours from a site’s robots.txt update for our systems to adjust.
用户代理 | 描述和详细信息 |
---|---|
OAI-搜索机器人 | OAI-SearchBot 用于搜索。OAI-SearchBot 用于在 ChatGPT 的搜索功能中链接到搜索结果并显示网站。它不用于抓取内容以训练 OpenAI 的生成式 AI 基础模型。为了确保您的网站出现在搜索结果中,我们建议您在网站的 robots.txt 文件中允许 OAI-SearchBot,并允许来自我们以下已发布 IP 地址范围的请求。 完整的用户代理字符串将包含 ; OAI-SearchBot/1.0; +https://openai.com/searchbot 已发布的 IP 地址:https://openai.com/searchbot.json |
ChatGPT-用户 | ChatGPT-User 用于 ChatGPT 和Custom GPT中的用户操作。当用户向 ChatGPT 或 CustomGPT 提问时,它可能会访问带有 ChatGPT-User 代理的网页。ChatGPT 用户还可以通过GPT Actions与外部应用程序交互。ChatGPT-User 控制这些用户请求可以发送到哪些网站。它不用于自动抓取网页数据,也不用于抓取用于生成式 AI 训练的内容。 完整的用户代理字符串: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; ChatGPT-User/1.0; +https://openai.com/bot 已发布的 IP 地址:https://openai.com/chatgpt-user.json |
GPT机器人 | GPTBot 用于提升我们生成式 AI 基础模型的实用性和安全性。它用于抓取可能用于训练我们生成式 AI 基础模型的内容。禁止 GPTBot 表示网站内容不应用于训练生成式 AI 基础模型。 完整的用户代理字符串: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; GPTBot/1.1; +https://openai.com/gptbot 已发布的 IP 地址:https://openai.com/gptbot.json |
既然遵守 robot.txt,最简单的做法就是修改它,在其中禁止 OpenAI 的爬虫爬取,比如:
User-agent: GPTBot
Disallow: /
User-agent: ChatGPT-User
Disallow: /
封 IP 段
如果你不太信任 robots.txt 的君子协议,你也可以根据上个表格中的 IP 地址列表,简单粗暴的封禁其爬虫的 IP。
以 GPTBot 为例,在服务器/nginx 等防火墙中加入以下 IP:
"prefixes": [
{
"ipv4Prefix": "52.230.152.0/24"
},
{
"ipv4Prefix": "20.171.206.0/24"
},
{
"ipv4Prefix": "20.171.207.0/24"
},
{
"ipv4Prefix": "4.227.36.0/25"
},
{
"ipv4Prefix": "20.125.66.80/28"
},
{
"ipv4Prefix": "172.182.204.0/24"
},
{
"ipv4Prefix": "172.182.214.0/24"
},
{
"ipv4Prefix": "172.182.215.0/24"
封禁 UA
这种办法需要你为自己的网站配置开启了 WAF,就不展开了。
阿玛忒拉…Anubis!
阿努比斯是一个通过要求浏览器执行一定量的数学计算以验证访问真实性来阻挡爬虫攻击的项目。简单来说,在你运行的网站前挂上这个就行。不过也可能误伤某些无害的爬虫,比如搜索引擎或 Internet Archive。
Notbyai
凑巧的是,早些时候刚给网站页脚添加了一个 badge,来自 notbyai.fyi 的用以表明自己的原创内容是“90%人类创作”的。
实际上现在几乎很难说我发表的内容是完全没有 AI 参与创作的。事实表明,AI 在润色语言、整合网络信息上确实高效而强力。这种 90%的弹性政策就非常巧妙的维护了作者使用 LLM 的权利。
况且,鼓励人类创作原创内容实际上是符合这些 AI 公司利益的,该网站也毫不避讳的指出,“人工智能 (AI) 是使用人类创建的内容进行训练的。如果人类停止制作新内容并完全依赖 AI,世界各地的在线内容可能会变得重复和停滞。”
最近的几篇文章封面都有豆包 AI 的助力,但直接交由其生成的封面大多在文字上完全不可用。因此工作流实际上是由豆包根据文章内容总结摘要并提供封面设计灵感,图像生成一张背景图,然后由我使用 Photo Editor 添加文字等内容。
我想我们迟早要为与 AI 合作做好准备。