Robots协议 实例一京东 实例二亚马逊
绪论 网络爬虫引发的问题
1、网络爬虫的尺寸
爬取网页 Requests库
爬取网站 Scrapy库
爬取全网 建立搜索引擎
2、网络爬虫引发的问题
1.服务器性能骚扰
2.法律风险
3.泄露隐私
3、网络爬虫的限制
来源审查:判断User-Agent进行限制
检查来访HTTP协议头的User-Agent域,只响应浏览器或友好爬虫的访问
发布公告:
告知所有爬虫网站的爬取策略,要求爬虫遵守。
一、Robots协议
Robots Exclusion Standard 网络爬虫排除标准
作用:网站告知网络爬虫哪些页面可以抓取,哪些不行。
形式:在网站根目录下的robots。txt文件
eg.京东的Robots协议 https://www.jd.com/robots.txt
User-agent: * #不可以爬取/?开头的网页 等等…… Disallow: /?* Disallow: /pop/*.html Disallow: /pinpai/*.html?* User-agent: EtaoSpider #以下四种spider为恶意爬虫,不可以爬任何网页 Disallow: / User-agent: HuihuiSpider Disallow: / U