# 8-验证码的识别

目前，许多网站采取各种各样的措施来反爬虫，其中一个措施便是使用验证码。随着技术的发展，验证码的花样越来越多。验证码最初是几个数字组合的简单的图形验证码，后来加入了英文字母和混淆曲线。有的网站还可能看到中文字符的验证码，这使得识别愈发困难。

后来 12306 验证码的出现使得行为验证码开始发展起来，用过 12306 的用户肯定多少为它的验证码头疼过。我们需要识别文字，点击与文字描述相符的图片，验证码完全正确，验证才能通过。现在这种交互式验证码越来越多，如极验滑动验证码需要滑动拼合滑块才可以完成验证，点触验证码需要完全点击正确结果才可以完成验证，另外还有滑动宫格验证码、计算题验证码等。

验证码变得越来越复杂，爬虫的工作也变得愈发艰难。有时候我们必须通过验证码的验证才可以访问页面。本章就专门针对验证码的识别做统一讲解。

本章涉及的验证码有普通图形验证码、极验滑动验证码、点触验证码、微博宫格验证码，这些验证码识别的方式和思路各有不同。了解这几个验证码的识别方式之后，我们可以举一反三，用类似的方法识别其他类型验证码。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://python3webspider.cuiqingcai.com/8-yan-zheng-ma-de-shi-bie.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
