Web crawler is legitimate?

Web crawlers legal?

Web crawlers field is still part of the early pioneering stage, although the Internet world have established a certain code of ethics (Robots protocol) through its own protocol, but the law is still part of the establishment and improvement. From the current situation, if the captured data is personal use or research areas, the basic problem does not exist; and if the data belongs to the category of business profits, it is necessary on the matter concerned, there might be illegal, there may not be illegal.

1.2.1 Robots agreement

Full name of Robots protocol (reptiles protocol) is a "web crawler exclusion criteria" (Robots Exclusion Protocol), the site tells the search engines which pages can be crawled by Robots agreement, which can not crawl the page. The agreement is the international Internet community accepted moral standards, although there is no written law, but every reptile should comply with this agreement.

Below robots.txt Taobao described as an example.

Here only the interception of part of the code for a complete code can access https://www.taobao.com/robots.txt.

User-agent:  Baiduspider    #百度爬虫引擎
Allow:  /article     #允许访问/article.htm、/article/12345.com
Allow:  /oshtml      
Allow:  /ershou
Disallow:  /product/ #禁止访问/product/12345.com
Disallow:  /         #禁止访问除Allow规定页面外的其他所有页面

User-Agent:  Googlebot   #谷歌爬虫引擎
Allow:  /article
Allow:  /oshtml
Allow:  /product     #允许访问/product.htm、/product/12345.com
Allow:  /spu
Allow:  /dianpu
Allow:  /wenzhang
Allow:  /oversea
Disallow:  /

In the above robots file, Taobao user agent provides for the reptiles engine Baidu.

Allow URL beginning with the value of the item is to allow the robot to access. For example, Allow: / article allows access /article.htm,/article/12345.com engine Baidu and other reptiles.

To Disallow entry for the beginning of the link is not allowed to access Baidu engine crawlers. For example, Disallow: / product / reptiles engine Baidu is not allowed access /product/12345.com and so on.

The last line, Disallow: / ban Baidu reptiles access to all other pages in addition to Allow specified page.

So when you're in the Baidu search for "Taobao" when small print under the search results will appear: "Because there is a limit instruction (limit the search engines to crawl) of the site's robots.txt file, the system can not provide a description of the contents of the page" Figure 1-1. As a search engine Baidu, Taobao good robot.txt comply with the agreement, so you are not from the Baidu search to Taobao internal product information.
Here Insert Picture Description
Taobao Robots agreement is not the same for the treatment of Google reptiles, reptiles and Baidu is different is that it allows Google crawling reptile product page Allow: / product. So, when you Google search for "Taobao iphone7", they can search to Taobao's product, shown in Figure 1-2.
Here Insert Picture Description
When you crawl website data, whether for personal use only, you should abide by Robots agreement.

1.2.2 Web crawler constraints

In addition to the above-mentioned Robots agreement, we have to use the Web crawler to time constraints themselves: too fast or frequent web crawler will have an enormous pressure on the server, the site may be blocking your IP, or even to take further legal action. Therefore, you need to restrain their web crawler behavior, the requested speed limit within a reasonable range.

Tips in this book reptiles only for learning, research purposes, please do not use for illegal purposes. Any legal disputes arising therefrom, please handle it alone.

In fact, since web crawler data acquired tremendous value, web crawler gradually turned into a war party websites and reptiles party, your spear inch long, an inch thick will my shield. Ctrip micro-technology share, Ctrip hotel R & D R & D manager Cui Guangyu had to share a "March reptile" story, which is the annual March will usher in a reptile peak. Because there are a large number of students hand in their papers in May, I will choose crawling data when writing papers, that is, March crawling data, analyze the data for April, May hand in their papers.

Therefore, the major Internet giants have already begun to mobilize resources to limit the reptiles, protect the user's traffic and reduce the loss of valuable data.

2007年,爱帮网利用垂直搜索技术获取了大众点评网上的商户简介和消费者点评,并且直接大量使用。大众点评网多次要求爱帮网停止使用这些内容,而爱帮网以自己是使用垂直搜索获得的数据为由,拒绝停止抓取大众点评网上的内容,并且质疑大众点评网对这些内容所享有的著作权。为此,双方开打了两场官司。2011年1月,北京海淀法院做出判决:爱帮网侵犯大众点评网著作权成立,应当停止侵权并赔偿大众点评网经济损失和诉讼必要支出。

2013年10月,百度诉360违反Robots协议。百度方面认为,360违反了Robots协议,擅自抓取、复制百度网站内容并生成快照向用户提供。2014年8月7日,北京市第一中级人民法院做出一审判决,法院认为被告奇虎360的行为违反了《反不正当竞争法》相关规定,应赔偿原告百度公司70万元。

虽然说大众点评上的点评数据、百度知道的问答由用户创建而非企业,但是搭建平台需要投入运营、技术和人力成本,所以平台拥有对数据的所有权、使用权和分发权。

以上两起败诉告诉我们,在爬取网站的时候需要限制自己的爬虫,遵守Robots协议和约束网络爬虫程序的速度;在使用数据的时候必须遵守网站的知识产权。如果违反了这些规定,很可能会吃官司,并且败诉的概率相当高。

目录
前言
第1章 网络爬虫入门1
1.1 为什么要学网络爬虫2
1.1.1 网络爬虫能带来什么好处2
1.1.2 能从网络上爬取什么数据3
1.1.3 应不应该学爬虫3
1.2 网络爬虫是否合法3
1.2.1 Robots协议4
1.2.2 网络爬虫的约束5
1.3 网络爬虫的基本议题6
1.3.1 Python爬虫的流程7
1.3.2 三个流程的技术实现7
第2章 编写第一个网络爬虫9
2.1 搭建Python平台10
2.1.1 Python的安装10
2.1.2 使用pip安装第三方库12
2.1.3 使用编辑器Jupyter 编程13
2.1.4 使用编辑器Pycharm编程15
2.2 Python 使用入门18
2.2.1 基本命令18
2.2.2 数据类型19
2.2.3 条件语句和循环语句21
2.2.4 函数23
2.2.5 面向对象编程24
2.2.6 错误处理28
2.3 编写第一个简单的爬虫29
2.3.1 第一步:获取页面29
2.3.2 第二步:提取需要的数据30
2.3.3 第三步:存储数据32
2.4 Python实践:基础巩固33
2.4.1 Python基础试题34
2.4.2 参考答案35
2.4.3 自我实践题38
第3章 静态网页抓取39
3.1 安装Requests40
3.2 获取响应内容40
3.3 定制Requests41
3.3.1 传递URL参数41
3.3.2 定制请求头42
3.3.3 发送POST请求43
3.3.4 超时44
3.4 Requests爬虫实践:TOP250电影数据44
3.4.1 网站分析45
3.4.2 项目实践45
3.4.3 自我实践题47
第4章 动态网页抓取48
4.1 动态抓取的实例49
4.2 解析真实地址抓取50
4.3 通过Selenium模拟浏览器抓取55
4.3.1 Selenium的安装与基本介绍55
4.3.2 Selenium的实践案例57
4.3.3 Selenium获取文章的所有评论58
4.3.4 Selenium的高级操作61
4.4 Selenium爬虫实践:深圳短租数据64
4.4.1 网站分析64
4.4.2 项目实践66
4.4.3 自我实践题69
第5章 解析网页70
5.1 使用正则表达式解析网页71
5.1.1 re.match方法71
5.1.2 re.search方法74
5.1.3 re.findall方法74
5.2 使用BeautifulSoup解析网页76
5.2.1 BeautifulSoup的安装76
5.2.2 使用BeautifulSoup获取博客标题77
5.2.3 BeautifulSoup的其他功能78
5.3 使用lxml解析网页82
5.3.1 lxml的安装82
5.3.2 使用lxml获取博客标题82
5.3.3 XPath的选取方法84
5.4 总结85
5.5 BeautifulSoup爬虫实践:房屋价格数据86
5.5.1 网站分析86
5.5.2 项目实践87
5.5.3 自我实践题89
第6章 数据存储90
6.1 基本存储:存储至TXT或CSV91
6.1.1 把数据存储至TXT91
6.1.2 把数据存储至CSV93
6.2 存储至MySQL数据库94
6.2.1 下载安装MySQL95
6.2.2 MySQL的基本操作99
6.2.3 Python操作MySQL数据库104
6.3 存储至MongoDB数据库106
6.3.1 下载安装MongoDB107
6.3.2 MongoDB的基本概念110
6.3.3 Python操作MongoDB数据库112
6.3.4 RoboMongo的安装与使用113
6.4 总结115
6.5 MongoDB爬虫实践:虎扑论坛116
6.5.1 网站分析116
6.5.2 项目实践117
6.5.3 自我实践题123
第7章 Scrapy框架124
7.1 Scrapy是什么125
7.1.1 Scrapy架构125
7.1.2 Scrapy数据流(Data Flow)126
7.1.3 选择Scrapy还是Requests+bs4127
7.2 安装Scrapy128
7.3 通过Scrapy抓取博客128
7.3.1 创建一个Scrapy项目128
7.3.2 获取博客网页并保存129
7.3.3 提取博客标题和链接数据131
7.3.4 存储博客标题和链接数据133
7.3.5 获取文章内容134
7.3.6 Scrapy的设置文件136
7.4 Scrapy爬虫实践:财经新闻数据137
7.4.1 网站分析137
7.4.2 项目实践138
7.4.3 自我实践题141
第8章 提升爬虫的速度142
8.1 并发和并行,同步和异步143
8.1.1 并发和并行143
8.1.2 同步和异步143
8.2 多线程爬虫144
8.2.1 简单的单线程爬虫145
8.2.2 学习Python多线程145
8.2.3 简单的多线程爬虫148
8.2.4 使用Queue的多线程爬虫150
8.3 多进程爬虫153
8.3.1 使用multiprocessing的多进程爬虫153
8.3.2 使用Pool + Queue的多进程爬虫155
8.4 多协程爬虫158
8.5 总结160
第9章 反爬虫问题163
9.1 为什么会被反爬虫164
9.2 反爬虫的方式有哪些164
9.2.1 不返回网页165
9.2.2 返回非目标网页165
9.2.3 获取数据变难166
9.3 如何“反反爬虫”167
9.3.1 修改请求头167
9.3.2 修改爬虫的间隔时间168
9.3.3 使用代理171
9.3.4 更换IP地址172
9.3.5 登录获取数据172
9.4 总结172
第10章 解决中文乱码173
10.1 什么是字符编码174
10.2 Python的字符编码176
10.3 解决中文编码问题179
10.3.1 问题1:获取网站的中文显示乱码179
10.3.2 问题2:非法字符抛出异常180
10.3.3 问题3:网页使用gzip压缩181
10.3.4 问题4:读写文件的中文乱码182
10.4 总结184
第11章 登录与验证码处理185
11.1 处理登录表单186
11.1.1 处理登录表单186
11.1.2 处理cookies,让网页记住你的登录190
11.1.3 完整的登录代码193
11.2 验证码的处理194
11.2.1 如何使用验证码验证195
11.2.2 人工方法处理验证码197
11.2.3 OCR处理验证码200
11.3 总结203
第12章 服务器采集204
Here Insert Picture Description
此书已加入到VIP会员卡,只要购买VIP会员卡即可免费阅读上百本电子书,这张VIP卡除了免费让你读书,还有更多的权益等你来领,往下↓拉

购买链接:
买这个卡后不仅可以享受价值上万元的电子书免费阅读权限

还可以享受到以下这些权益呢:

400次在CSDN下载频道下载资源的机会

1000多门的课程可以免费看

购买CSDN学院课程可享受9折专属优惠

CSDN网站免广告哦

Released eight original articles · won praise 17 · views 2770

Guess you like

Origin blog.csdn.net/weixin_37649168/article/details/104295099