1.2爬虫超级鹰验证码识别

import request
from lxml import etree
from chaojiying import Chaojiying_Client
if __name__ == '__main__':
    head = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36 Edg/118.0.2088.46'}
    url = 'https://so.gushiwen.cn/user/login.aspx?from=http://so.gushiwen.cn/user/'
    resp_text = requests.get(url, head).text
    tree = etree.HTML(resp_text)
    contain = tree.xpath('//div/img[@id="imgCode"]/@src')

#    print(contain)
    # 获取验证码图片地址
    img_url = 'https://so.gushiwen.cn/' + contain[0]
    resp_img = requests.get(img_url,headers=head).content
    # 下载验证码图片到本地
    with open("./code.jpg",'wb')as ws:
        ws.write(resp_img)
    print("success!!!!")

    # 调用超级鹰案例代码即可
    chaojiying_one = Chaojiying_Client('481429427', 'zdc250.1', '953676')  # 用户中心>>软件ID 生成一个替换 96001
    im = open('./code.jpg', 'rb').read()  # 本地图片文件路径 来替换 a.jpg 有时WIN系统须要//
    print(chaojiying_one.PostPic(im, 1902))

成功实现图

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值