网络爬虫的网络规范

网络爬虫引发的问题

网络爬虫的尺寸

网络爬虫的“性能骚扰”

Web服务器默认接收人类访问
受限于编写水平和目的,网络爬虫将会为Web服务器带来巨大的资源开销

网络爬虫的法律风险

服务器上的数据有产权归属
网络爬虫获取数据后牟利将带来法律风险

网络爬虫的隐私泄露

网络爬虫可能具备突破简单访问控制的能力,获得被保护数据
从而泄露个人隐私

网络爬虫引发的问题

性能骚扰
法律风险
隐私泄露

网络爬虫的限制

• 来源审查:判断User‐Agent进行限制
    检查来访HTTP协议头的User‐Agent域,只响应浏览器或友好爬虫的访问
• 发布公告:Robots协议
    告知所有爬虫网站的爬取策略,要求爬虫遵守

 

Robots协议

Robots协议

 

Robots Exclusion Standard,网络爬虫排除标准
作用:
    网站告知网络爬虫哪些页面可以抓取,哪些不行
形式:
    在网站根目录下的robots.txt文件

 

 

案例:京东的 Robots协议

https://www.jd.com/robots.txt

 

[plain] view plain copy
 
  1. User‐agent: *  
  2. Disallow: /?*  
  3. Disallow: /pop/*.html  
  4. Disallow: /pinpai/*.html?*  
  5. User‐agent: EtaoSpider  
  6. Disallow: /  
  7. User‐agent: HuihuiSpider  
  8. Disallow: /  
  9. User‐agent: GwdangSpider  
  10. Disallow: /  
  11. User‐agent: WochachaSpider  
  12. Disallow: /  
[plain] view plain copy
 
  1. # 注释,*代表所有,/代表根目录  
  2. User‐agent: *  
  3. Disallow: /  
Robots协议基本语法

 

案例:真实的Robots协议

 

http://www.baidu.com/robots.txt
http://news.sina.com.cn/robots.txt
http://www.qq.com/robots.txt
http://news.qq.com/robots.txt
http://www.moe.edu.cn/robots.txt (无robots协议)

Robots协议的遵守方式

实际操作中,该如何遵守Robots协议?

Robots协议的使用

网络爬虫:
    自动或人工识别robots.txt,再进行内容爬取
约束性:
    Robots协议是建议但非约束性,网络爬虫可以不遵守,但存在法律风险

 

对Robots协议的理解

 

posted @ 2017-12-12 11:09  哦摩西罗伊  阅读(1286)  评论(0编辑  收藏  举报