前言
上一节学习了requests库,这一节学习robots协议
限制爬虫的方法
- 审查爬虫来源,需要网站作者有一定的编程基础
- 声明robots协议,一般放在网站的根目录下,robots.txt文件
京东robots协议
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: /