首页 > 其他 > 详细

网络爬虫的“盗亦有道”

时间:2020-01-12 10:49:59      阅读:91      评论:0      收藏:0      [点我收藏+]

2.1 网络爬虫引发的问题

技术分享图片

                                                             图 网络爬虫的尺寸

 

网络爬虫的限制

  来源审查:判断User-Agent进行限制

  •   检查来访HTTP协议头的User-Agent域,只响应浏览器或者友好爬虫的访问。

  发布公告:Robots协议

  •   告知所有爬虫网站的爬取策略,要求爬虫遵守

 

2.2 Robots协议

Robots Exclusion Standard 网络爬虫排除标准

  作用:网站告知网络爬虫哪些页面可以抓取,哪些不行。

  形式:在网站根目录下的robots.txt文件。

 

例子:京东的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: /

http://www.baidu.com/robots.txt

http://www.sina.com.cn/robots.txt

http://news.sina.com.cn/robots.txt

http://www.qq.com/robots.txt

http://news.qq.com/robots.txt

http://www.sdju.edu.cn/robots.txt(无robots协议)

 

Robots协议的使用

  网络爬虫:自动或人工识别robots.txt,再进行内容爬取。

  约束性:Robots协议是建议但非约束性,网络爬虫可以不遵守,但存在法律风险。

网络爬虫的“盗亦有道”

原文:https://www.cnblogs.com/cripplepx/p/12181414.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!