Robots协议 以京东为例子https://www.jd.com/robots.txt
User-agent: * //代表任何的网络爬虫都应该遵守以下协议 Disallow: /?* //任何的网络爬虫都不允许访问以?开头的路径 Disallow: /pop/*.html Disallow: /pinpai/*.html?* User-agent: EtaoSpider Disallow: / User-agent: HuihuiSpider Disallow: / User-agent: GwdangSpider Disallow: / User-agent: WochachaSpider Disallow: /
基本语法
# 注释, *代表所有,/代表根目录
User-agent:*
Disallow:/
Robots协议的使用
网络爬虫:自动或人工识别robots.txt,再进行内容爬取。
约束性:Robots协议是建议但非约束性,网络爬虫可以不遵守,但存在法律风险。