2018.5.4(python网络爬虫与信息提取入门)Robots协议

网络爬虫的尺寸:

Requests库:小规模,数据量小,爬取速度不敏感(爬取网页,玩转网页)

Scrapy库:中规模,数据规模量大,爬取速度敏感(爬取系列网站)

定制开发:大规模,搜索引擎,爬取速度管脚(爬取全网)

网络爬虫的限制:

来源审查:判断User-Agent进行限制 ;检查来访HTTP协议头的User-Agent域,只响应浏览器或友好爬虫的访问

发布公告:Ronots协议;告知所有爬虫网站的爬取策略,要求爬虫遵守


Robots协议  (Robots Exclusion Standard 网络爬虫排除标准)

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

User-agent  (哪些爬虫)

Disallow  (不允许爬取的资源目录


例: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: /

猜你喜欢

转载自blog.csdn.net/weixin_41815104/article/details/80190756