nginx屏蔽AI爬虫,节省不必要的服务器cpu和网络开支(GPTBot,meta-externa ...

打印 上一主题 下一主题

主题 1841|帖子 1841|积分 5523

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

x
思量到这些爬虫压根不遵守robots规则,以是直接在nginx服务器内里拦截最有效,各人可以将以下代码放在nginx网站配置文件里,放在
server内里就行了。以下列举了一部门爬虫,后面假如有更新,最新的代码会在该站更新nginx屏蔽AI爬虫,节省不必要的服务器cpu和网络开支(GPTBot,meta-externalagent,Amazonbot) - Bcoder资源网
   if ($http_user_agent ~* "SemrushBot/7~bl|YandexBot|Amazonbot/0.1|GPTBot/1.2|GPTBot|Bytespider|meta-externalagent|Amazonbot|GPTBot|Meta-ExternalAgent|FeedDemon|Indy Library|Alexa Toolbar|AskTbFXTV|AhrefsBot|CrawlDaddy|CoolpadWebkit|Java|Feedly|UniversalFeedParser|ApacheBench|Microsoft URL Control|Swiftbot|ZmEu|oBot|jaunty|Python-urllib|lightDeckReports Bot|YYSpider|DigExt|HttpClient|MJ12bot|heritrix|EasouSpider|Ezooms|^$" ) {
       return 301 https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&tn=baidu&wd=q.wpcoder.cn;
  }
  
恒久以来活泼在互联网上的爬虫都非常多,这些爬虫通常没有自己的独立名称,都是伪装成各种模拟用户的 UserAgent 进行抓爬。
如今更多爬虫是为了抓取数据用于练习 AI 模型,至少规模较大的 AI 公司会公布自己的爬虫名称,网站管理员可以屏蔽这些爬虫避免数据被抓取。
为什么要屏蔽 AI 爬虫:
这些爬虫的主要目的就是抓取你的网站内容拿去练习人工智能模型,这几乎不会给你的网站带来任何流量或其他正面反馈,因此直接屏蔽并没有什么大不了的。
固然正如 OpenAI 所说,允许 AI 爬虫抓取数据用于练习人工智能模型能够早日实现 AGI,为了这个宏大的抱负你是否愿意被抓取呢?反正大多数大型出版商 (例如消息网站) 都是不允许抓取的。
Ai Robots 开源项目:
该项目收集了众多已知的 AI 公司爬虫和少数不友爱的爬虫,各位站长可以放心屏蔽,屏蔽后不影响网站的正常运行和继续获取来自主要搜刮引擎的流量。

固然假如你不放心的话也可以将部门爬虫注释掉允许其继续抓取内容,假如你想了解每个爬虫的详细阐明,请直接谷歌搜刮爬虫名称,可以找到开发商的阐明。
项目地址:https://github.com/ai-robots-txt/ai.robots.txt
下面是爬虫列表:

  • User–agent: AI2Bot
  • User–agent: Ai2Bot–Dolma
  • User–agent: Amazonbot
  • User–agent: anthropic–ai
  • User–agent: Applebot
  • User–agent: Applebot–Extended
  • User–agent: Bytespider
  • #注意:Bytespider是字节跳动的爬虫,也用于头条搜刮,请根据网站来自头条的流量决定是否要屏蔽
  • User–agent: CCBot
  • User–agent: ChatGPT–User
  • #注意:ChatGPT-User是署理用户访问的爬虫,该爬虫不用于收集数据练习AI,请根据环境自行决定是否屏蔽
  • User–agent: Claude–Web
  • User–agent: ClaudeBot
  • User–agent: cohere–ai
  • User–agent: Diffbot
  • User–agent: DuckAssistBot
  • User–agent: FacebookBot
  • User–agent: facebookexternalhit
  • User–agent: FriendlyCrawler
  • User–agent: Google–Extended
  • User–agent: GoogleOther
  • User–agent: GoogleOther–Image
  • User–agent: GoogleOther–Video
  • User–agent: GPTBot
  • User–agent: iaskspider/2.0
  • User–agent: ICC–Crawler
  • User–agent: ImagesiftBot
  • User–agent: img2dataset
  • User–agent: ISSCyberRiskCrawler
  • User–agent: Kangaroo Bot
  • User–agent: Meta–ExternalAgent
  • User–agent: Meta–ExternalFetcher
  • User–agent: OAI–SearchBot
  • User–agent: omgili
  • User–agent: omgilibot
  • User–agent: PerplexityBot
  • User–agent: PetalBot
  • User–agent: Scrapy
  • User–agent: Sidetrade indexer bot
  • User–agent: Timpibot
  • User–agent: VelenPublicWebCrawler
  • User–agent: Webzio–Extended
  • User–agent: YouBot
robots.txt 示例:

  1. User-agent: *
  2. Allow: /wp-*/uploads/*
  3. Allow: /wp-*/themes/*
  4. Allow: /archives/user/1
  5. Disallow: /trackback
  6. Disallow: /wp-*
  7. Disallow: /\?p=*
  8. Disallow: /?p=*
  9. Disallow: /?s=*
  10. Disallow: /*/attachment/*
  11. Disallow: /?post_type=post&s=*
  12. Disallow: /*?post_type=post
  13. Disallow: /*?post_type=download
  14. Disallow: /*?post_type=product
  15. Disallow: /*?post_type=video
  16. Disallow: /*?post_type=moment
  17. Disallow: /*?post_type=topic
  18. Disallow: /archives/user/*
  19. Sitemap: https://www.landiannews.com/sitemap.xml
  20. User-agent: MJ12bot
  21. Disallow: /
  22. User-agent: istellabot
  23. Disallow: /
  24. User-agent: SemrushBot
  25. Disallow: /
  26. User-agent: SemrushBot-SA
  27. Disallow: /
  28. User-agent: Dotbot
  29. Disallow: /
  30. User-agent: CriteoBot/0.1
  31. Disallow: /
  32. User-agent: ClaudeBot
  33. Disallow: /
  34. User-agent: AI2Bot
  35. Disallow: /
  36. User-agent: Ai2Bot-Dolma
  37. Disallow: /
  38. User-agent: Amazonbot
  39. Disallow: /
  40. User-agent: anthropic-ai
  41. Disallow: /
  42. User-agent: Applebot
  43. Disallow: /
  44. User-agent: Applebot-Extended
  45. Disallow: /
  46. #User-agent: Bytespider
  47. #Disallow: /
  48. User-agent: CCBot
  49. Disallow: /
  50. #User-agent: ChatGPT-User
  51. #Disallow: /
  52. User-agent: Claude-Web
  53. Disallow: /
  54. User-agent: ClaudeBot
  55. Disallow: /
  56. User-agent: cohere-ai
  57. Disallow: /
  58. User-agent: Diffbot
  59. Disallow: /
  60. User-agent: DuckAssistBot
  61. Disallow: /
  62. User-agent: FacebookBot
  63. Disallow: /
  64. User-agent: facebookexternalhit
  65. Disallow: /
  66. User-agent: FriendlyCrawler
  67. Disallow: /
  68. User-agent: Google-Extended
  69. Disallow: /
  70. User-agent: GoogleOther
  71. Disallow: /
  72. User-agent: GoogleOther-Image
  73. Disallow: /
  74. User-agent: GoogleOther-Video
  75. Disallow: /
  76. User-agent: GPTBot
  77. Disallow: /
  78. User-agent: iaskspider/2.0
  79. Disallow: /
  80. User-agent: ICC-Crawler
  81. Disallow: /
  82. User-agent: ImagesiftBot
  83. Disallow: /
  84. User-agent: img2dataset
  85. Disallow: /
  86. User-agent: ISSCyberRiskCrawler
  87. Disallow: /
  88. User-agent: Kangaroo Bot
  89. Disallow: /
  90. User-agent: Meta-ExternalAgent
  91. Disallow: /
  92. User-agent: Meta-ExternalFetcher
  93. Disallow: /
  94. #User-agent: OAI-SearchBot
  95. #Disallow: /
  96. User-agent: omgili
  97. Disallow: /
  98. User-agent: omgilibot
  99. Disallow: /
  100. User-agent: PerplexityBot
  101. Disallow: /
  102. User-agent: PetalBot
  103. Disallow: /
  104. User-agent: Scrapy
  105. Disallow: /
  106. User-agent: Sidetrade indexer bot
  107. Disallow: /
  108. User-agent: Timpibot
  109. Disallow: /
  110. User-agent: VelenPublicWebCrawler
  111. Disallow: /
  112. User-agent: Webzio-Extended
  113. Disallow: /
  114. User-agent: YouBot
  115. Disallow: /
复制代码

需要提醒的是 robots.txt 文件属于君子协定,此前 PerplexityBot 爬虫就被发现即便屏蔽也会继续抓取内容,以是仅仅依靠君子协定显然是不够的。
你甚至可以在 Nginx 服务器中直接将这些爬虫名称加入黑名单,在它们实验抓爬时直接返回 HTTP 444 丢弃连接,如许也可以阻止内容被抓取。
但请注意:假如你在服务器上执行屏蔽操纵那 robots.txt 文件就无效了,因为爬虫刚抵达服务器就直接被拦截,因此它们也无法先查抄 robots.txt 文件是否允许抓取,在这种环境下这些爬虫可能会反复、高频抓取然后被丢弃连接。
假如仅通过 robots.txt 操纵,则爬虫遵守协议的环境下它们不会再对其他内容进行抓爬,但假如不遵守协定那就会继续反复抓爬并给你的服务器造成压力。

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

天空闲话

论坛元老
这个人很懒什么都没写!
快速回复 返回顶部 返回列表