> For the complete documentation index, see [llms.txt](https://book.rizon.top/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.rizon.top/xue-xi-bi-ji/python/pa-chong.md).

# 爬虫教程

\[TOC]

## 参考资料

[Python3爬虫视频学习教程](http://cuiqingcai.com/4320.html)\
[Beautiful Soup 4.4.0 文档](http://beautifulsoup.readthedocs.io/zh_CN/latest/)

## 小实例入手

[Python爬虫实战（4）：抓取淘宝MM照片](http://python.jobbole.com/81359/)

## BeautifulSoup

| 解析器           | 使用方法                                                                 | 优势                              | 劣势                                  |
| ------------- | -------------------------------------------------------------------- | ------------------------------- | ----------------------------------- |
| Python标准库     | BeautifulSoup(markup, "html.parser")                                 | Python的内置标准库 执行速度适中 文档容错能力强     | Python 2.7.3 or 3.2.2)前 的版本中文档容错能力差 |
| lxml HTML 解析器 | BeautifulSoup(markup, "lxml")                                        | 速度快 文档容错能力强                     | 需要安装C语言库                            |
| lxml XML 解析器  | BeautifulSoup(markup, \["lxml", "xml"])；BeautifulSoup(markup, "xml") | 速度快 唯一支持XML的解析器                 | 需要安装C语言库                            |
| html5lib      | BeautifulSoup(markup, "html5lib")                                    | 最好的容错性；以浏览器的方式解析文档；生成HTML5格式的文档 | 速度慢；不依赖外部扩展                         |
