【某度贴吧】验证码识别
首先采集使用了【自研简易验证码爬虫框架】
一般的验证码获取流程分为三大步骤
- 前置请求, 获取验证码相关参数
- 验证码请求, 获取验证码
- 校验请求, 通过官网判定验证码是否正确
通过继承 Project 类实现具体的流程 utils.Project
def before_process()-> dict
, 返回其他流程需要的参数字典, 通过self.before_params
访问def captcha_process() -> Tuple[bytes, str]
, 返回验证码图片bytes和识别后的内容def feedback_process() -> bool
, 返回验证码反馈情况,是否正确
在 const.json 文件中补充自己的 联众账号 和 百度API 以及样本保存的路径
{
"baidu": {
"app_id": "app_id",
"api_key": "api_key",
"secret_key": "secret_key"
},
"lianzhong": {
"username": "username",
"password": "password"
},
"target_dir": "D:/Samples"
}
编写流程: